OGS
anonymous_namespace{MatrixOutput.cpp} Namespace Reference

Functions

std::string getSeparatorAfterFilenamePrefix (std::string const &filenamePrefix)
 
static std::optional< std::string > getEnvironmentVariable (std::string const &env_var)
 
std::string localMatrixOutputFilename (std::string const &filenamePrefix)
 
Eigen::Map< const Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > > toSquareMatrixRowMajor (std::vector< double > entries)
 

Function Documentation

◆ getEnvironmentVariable()

static std::optional< std::string > anonymous_namespace{MatrixOutput.cpp}::getEnvironmentVariable ( std::string const & env_var)
static

Definition at line 72 of file MatrixOutput.cpp.

74{
75 char const* const prefix = std::getenv(env_var.c_str());
76 return prefix ? std::make_optional(prefix) : std::nullopt;
77}

◆ getSeparatorAfterFilenamePrefix()

std::string anonymous_namespace{MatrixOutput.cpp}::getSeparatorAfterFilenamePrefix ( std::string const & filenamePrefix)

Definition at line 26 of file MatrixOutput.cpp.

27{
28 return filenamePrefix.empty() || filenamePrefix.ends_with('/') ||
29 filenamePrefix.ends_with('\\')
30 ? ""
31 : "_";
32}

Referenced by localMatrixOutputFilename().

◆ localMatrixOutputFilename()

std::string anonymous_namespace{MatrixOutput.cpp}::localMatrixOutputFilename ( std::string const & filenamePrefix)

Definition at line 79 of file MatrixOutput.cpp.

80{
81 return fmt::format("{}{}ogs_local_matrix.log", filenamePrefix,
82 getSeparatorAfterFilenamePrefix(filenamePrefix));
83}
std::string getSeparatorAfterFilenamePrefix(std::string const &filenamePrefix)

References getSeparatorAfterFilenamePrefix().

◆ toSquareMatrixRowMajor()

Eigen::Map< const Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > > anonymous_namespace{MatrixOutput.cpp}::toSquareMatrixRowMajor ( std::vector< double > entries)

Definition at line 87 of file MatrixOutput.cpp.

88{
89 auto const num_r_c =
90 static_cast<Eigen::Index>(std::round(std::sqrt(entries.size())));
91
92 return {entries.data(), num_r_c, num_r_c};
93}