PeriDEM 0.2.0
PeriDEM -- Peridynamics-based high-fidelity model for granular media
Loading...
Searching...
No Matches
anonymous_namespace{input.cpp} Namespace Reference

Functions

bool definitelyGreaterThan (const double &a, const double &b)
 
void rectDataSizeWarning ()
 
std::string stringVecSerial (const std::vector< std::string > &svec)
 
void readGeometry (YAML::Node data, std::string data_block_name, std::string &name, std::vector< double > &params, std::pair< std::vector< std::string >, std::vector< std::string > > &complexInfo)
 
void readGeometry (YAML::Node data, std::string data_block_name, util::geometry::GeomData &geomData)
 

Function Documentation

◆ definitelyGreaterThan()

bool anonymous_namespace{input.cpp}::definitelyGreaterThan ( const double &  a,
const double &  b 
)
inline

Definition at line 28 of file input.cpp.

28 {
29 return (a - b) >
30 ((std::abs(a) < std::abs(b) ? std::abs(b) : std::abs(a)) * 1.0E-5);
31}

◆ readGeometry() [1/2]

void anonymous_namespace{input.cpp}::readGeometry ( YAML::Node  data,
std::string  data_block_name,
std::string &  name,
std::vector< double > &  params,
std::pair< std::vector< std::string >, std::vector< std::string > > &  complexInfo 
)

Definition at line 53 of file input.cpp.

57 {
58
59 if (!data["Type"]) {
60 std::cerr << "Error; Can not read geometry type in yaml data in block = "
61 << data_block_name << ".\n";
62 exit(EXIT_FAILURE);
63 }
64 name = data["Type"].as<std::string>();
65
66 if (name == "complex") {
67 // read vector of types and flags
68 if (data["Vec_Type"]) {
69 for (auto f: data["Vec_Type"])
70 complexInfo.first.push_back(f.as<std::string>());
71 } else {
72 std::cerr << "Error: To define complex geometry, we require vector of "
73 "types in yaml data block = "
74 << data_block_name << "\n";
75 exit(EXIT_FAILURE);
76 }
77
78 if (data["Vec_Flag"]) {
79 for (auto f: data["Vec_Flag"])
80 complexInfo.second.push_back(f.as<std::string>());
81 } else {
82 std::cerr << "Error: To define complex geometry, we require vector of "
83 "flags in yaml data block = "
84 << data_block_name << "\n";
85 exit(EXIT_FAILURE);
86 }
87 }
88
89 params.clear();
90 if (data["Parameters"]) {
91 for (auto f : data["Parameters"])
92 params.push_back(f.as<double>());
93 } else {
94 std::cerr << "Error: Parameters defining geometry is not present in data block = "
95 << data_block_name << ".\n";
96 exit(EXIT_FAILURE);
97 }
98}

Referenced by readGeometry().

Here is the caller graph for this function:

◆ readGeometry() [2/2]

void anonymous_namespace{input.cpp}::readGeometry ( YAML::Node  data,
std::string  data_block_name,
util::geometry::GeomData geomData 
)

Definition at line 100 of file input.cpp.

102 {
103 readGeometry(data,
104 data_block_name,
105 geomData.d_geomName,
106 geomData.d_geomParams,
107 geomData.d_geomComplexInfo);
108}
void readGeometry(YAML::Node data, std::string data_block_name, std::string &name, std::vector< double > &params, std::pair< std::vector< std::string >, std::vector< std::string > > &complexInfo)
Definition input.cpp:53
std::pair< std::vector< std::string >, std::vector< std::string > > d_geomComplexInfo
Zone geometry info if it is a complex type.
std::string d_geomName
Zone type.
std::vector< double > d_geomParams
Zone parameters.

References util::geometry::GeomData::d_geomComplexInfo, util::geometry::GeomData::d_geomName, util::geometry::GeomData::d_geomParams, and readGeometry().

Here is the call graph for this function:

◆ rectDataSizeWarning()

void anonymous_namespace{input.cpp}::rectDataSizeWarning ( )

Definition at line 33 of file input.cpp.

33 {
34 std::cout << "Warning: We now require rectangle to be specified "
35 "by 3 dimensional coordinates of corner points. In "
36 "future, this will be strongly preferred.\n";
37}

◆ stringVecSerial()

std::string anonymous_namespace{input.cpp}::stringVecSerial ( const std::vector< std::string > &  svec)

Definition at line 39 of file input.cpp.

39 {
40 if (svec.empty())
41 return "";
42
43 std::string s = "";
44 for (size_t i=0; i<svec.size(); i++) {
45 s = s + svec[i];
46 if (i < svec.size() - 1)
47 s = s + "; ";
48 }
49
50 return s;
51}