14 {
15
17
18 auto core_log = logging::core::get();
19 core_log->add_sink(
22
23 try {
24
25 moab::Core mb_instance;
26 moab::Interface &moab = mb_instance;
27 int rank;
28 MPI_Comm_rank(PETSC_COMM_WORLD, &rank);
29
30
33
36
41
42 MOFEM_LOG("ATOM_TEST",
Sev::verbose) << "<<<< SIDESETs >>>>>";
43
44 bool add_block_is_there = false;
46 {
48 strncpy(mybc.
data.name,
"Pressure", 8);
53 }
55 if (it->getMeshsetId() != 1002)
56 continue;
57 add_block_is_there = true;
59 CHKERR it->getBcDataStructure(mydata);
60
61 MOFEM_LOG(
"ATOM_TEST", Sev::inform) << mydata;
62 }
63 if (!add_block_is_there)
65 "no added block set");
66
67 MOFEM_LOG(
"ATOM_TEST", Sev::inform) <<
"<<<< BLOCKSETs >>>>>";
68
69 add_block_is_there = false;
71 std::vector<double> attr(3);
72 attr[0] = 0;
73 attr[1] = 1;
74 attr[2] = 2;
77
78 std::string name = it->getName();
79 if (name.compare(0, 13, "ADD_BLOCK_SET") == 0) {
80 add_block_is_there = true;
81 std::vector<double> attributes;
82 it->getAttributes(attributes);
83 if (attributes.size() != 3) {
85 "should be 3 attributes but is %zu", attributes.size());
86 }
87 if (attributes[0] != 0 || attributes[1] != 1 || attributes[2] != 2) {
89 "wrong values of attributes");
90 }
91 }
92 }
93 if (!add_block_is_there) {
95 "no added block set");
96 }
97 add_block_is_there = false;
99 {
101 mydata.
data.Young = 1;
102 mydata.
data.Poisson = 0.25;
104 mydata);
105 }
107 if (it->getMeshsetId() != 1001)
108 continue;
109
110 std::string name = it->getName();
111 if (name.compare(0, 13, "MAT_ELASTIC") == 0 &&
113 add_block_is_there = true;
115 CHKERR it->getAttributeDataStructure(mydata);
116
117 MOFEM_LOG(
"ATOM_TEST", Sev::inform) << mydata;
118 if (mydata.
data.Young != 1 || mydata.
data.Poisson != 0.25) {
120 "wrong values of attributes");
121 }
122 }
123 }
124 if (!add_block_is_there) {
126 "no added block set");
127 }
128
129 MOFEM_LOG(
"ATOM_TEST", Sev::inform) <<
"<<<< NODESET >>>>>";
130
133 std::memcpy(disp_bc.
data.name,
"Displacement", 12);
134 disp_bc.
data.flag1 = 1;
135 disp_bc.
data.flag2 = 1;
136 disp_bc.
data.flag3 = 1;
137 disp_bc.
data.flag4 = 0;
138 disp_bc.
data.flag5 = 0;
139 disp_bc.
data.flag6 = 0;
140 disp_bc.
data.value1 = 0;
141 disp_bc.
data.value2 = 0;
142 disp_bc.
data.value3 = 0;
143 disp_bc.
data.value4 = 0;
144 disp_bc.
data.value5 = 0;
145 disp_bc.
data.value6 = 0;
146
148
152 CHKERR it->getBcDataStructure(disp_data);
153 MOFEM_LOG(
"ATOM_TEST", Sev::inform) << disp_data;
154 }
155
157 << "<<<< ADD BLOCKSETs FROM CONFIG FILE >>>>>";
158
168
170 );
171
172
173 MOFEM_LOG(
"ATOM_TEST", Sev::inform) <<
"Iterate blocksets";
174
175 bool mat_elastic_trans_is_found = true;
176 bool users_array_attributes_found = false;
178 MOFEM_LOG(
"ATOM_TEST", Sev::inform) << *it;
180 std::vector<double> attributes;
181 it->getAttributes(attributes);
182 std::ostringstream ss;
183 ss << "Attr: ";
184 for (unsigned int ii = 0; ii != attributes.size(); ii++) {
185 ss << attributes[ii] << " ";
186 }
187 MOFEM_LOG(
"ATOM_TEST", Sev::inform) << ss.str();
188
189 if (it->getMeshsetId() == 1010) {
190 users_array_attributes_found = true;
191 if (attributes.size() != 11) {
193 "should be 11 attributes but is %zu", attributes.size());
194 }
195 for (unsigned int ii = 0; ii != attributes.size(); ii++) {
196 if (attributes[ii] != static_cast<double>(ii)) {
198 "wrong value from user_array");
199 }
200 }
201 }
202
203 std::string block_name = it->getName();
204 if (block_name.compare(0, block_name.size(), "MAT_ELASTIC_TRANS_ISO") ==
205 0) {
206 MOFEM_LOG(
"ATOM_TEST", Sev::inform) <<
"Mat Trans Iso block ";
207 mat_elastic_trans_is_found = true;
209 CHKERR it->getAttributeDataStructure(mydata);
210
211 MOFEM_LOG(
"ATOM_TEST", Sev::inform) << mydata;
212 if (mydata.
data.Youngp != 1)
214 if (mydata.
data.Youngz != 2)
216 if (mydata.
data.Poissonp != 3)
218 if (mydata.
data.Poissonpz != 4)
220 if (mydata.
data.Shearzp != 5)
222 }
223 }
224 if(!mat_elastic_trans_is_found)
226
229 CHKERR it->getAttributeDataStructure(mydata);
230 MOFEM_LOG(
"ATOM_TEST", Sev::inform) <<
"Mat elastic found ";
231 MOFEM_LOG(
"ATOM_TEST", Sev::inform) << mydata;
232 }
235 CHKERR it->getAttributeDataStructure(mydata);
236 MOFEM_LOG(
"ATOM_TEST", Sev::inform) <<
"Mat thermal found ";
237 MOFEM_LOG(
"ATOM_TEST", Sev::inform) << mydata;
238 }
241 CHKERR it->getBcDataStructure(mydata);
242 MOFEM_LOG(
"ATOM_TEST", Sev::inform) << mydata;
243 }
246 CHKERR it->getBcDataStructure(mydata);
247 MOFEM_LOG(
"ATOM_TEST", Sev::inform) << mydata;
248 }
251 CHKERR it->getBcDataStructure(mydata);
252 MOFEM_LOG(
"ATOM_TEST", Sev::inform) << mydata;
253 }
256 CHKERR it->getBcDataStructure(mydata);
257 MOFEM_LOG(
"ATOM_TEST", Sev::inform) << mydata;
258 }
261 CHKERR it->getBcDataStructure(mydata);
262 MOFEM_LOG(
"ATOM_TEST", Sev::inform) << mydata;
263 }
264 }
265 if (!users_array_attributes_found) {
267 "user_array attributes not found");
268 }
269 }
271
273}
#define CATCH_ERRORS
Catch errors.
@ MAT_ELASTICSET
block name is "MAT_ELASTIC"
@ MAT_THERMALSET
block name is "MAT_THERMAL"
@ MOFEM_OPERATION_UNSUCCESSFUL
@ MOFEM_ATOM_TEST_INVALID
#define CHKERR
Inline error check.
static LoggerType & setLog(const std::string channel)
Set ans resset chanel logger.
#define MOFEM_LOG(channel, severity)
Log.
SeverityLevel
Severity levels.
#define MOFEM_LOG_TAG(channel, tag)
Tag channel.
#define MOFEM_LOG_CHANNEL(channel)
Set and reset channel.
#define MOFEM_LOG_ATTRIBUTES(channel, bit)
Add attributes to channel.
MoFEMErrorCode setBcData(const CubitBCType cubit_bc_type, const int ms_id, const GenericCubitBcData &data)
Set boundary condition data for meshset.
MoFEMErrorCode setAttributes(const CubitBCType cubit_bc_type, const int ms_id, const std::vector< double > &attributes, const std::string name="")
Set attributes for CUBIT meshset.
#define _IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(MESHSET_MANAGER, CUBITBCTYPE, IT)
Iterator that loops over a specific Cubit MeshSet in a moFEM field.
MoFEMErrorCode addMeshset(const CubitBCType cubit_bc_type, const int ms_id, const std::string name="")
Add CUBIT meshset to manager.
#define _IT_CUBITMESHSETS_FOR_LOOP_(MESHSET_MANAGER, IT)
Iterator that loops over all the Cubit MeshSets in a moFEM field.
MoFEMErrorCode setAttributesByDataStructure(const CubitBCType cubit_bc_type, const int ms_id, const GenericAttributeData &data, const std::string name="")
Set attributes using data structure.
#define _IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_(MESHSET_MANAGER, CUBITBCTYPE, IT)
Iterator that loops over a specific Cubit MeshSet having a particular BC meshset in a moFEM field.
std::bitset< 32 > CubitBCType
static MoFEMErrorCode Initialize(int *argc, char ***args, const char file[], const char help[])
Initializes the MoFEM database PETSc, MOAB and MPI.
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
Deprecated interface functions.
Definition of the displacement bc data structure.
Definition of the force bc data structure.
Definition of the heat flux bc data structure.
Log manager is used to build and partition problems.
static boost::shared_ptr< SinkType > createSink(boost::shared_ptr< std::ostream > stream_ptr, std::string comm_filter)
Create a sink object.
static boost::shared_ptr< std::ostream > getStrmSelf()
Get the strm self object.
Transverse Isotropic material data structure.
Elastic material data structure.
Thermal material data structure.
Interface for managing meshsets containing materials and boundary conditions.
MoFEMErrorCode setMeshsetFromFile(const string file_name, const bool clean_file_options=true)
add blocksets reading config file
Definition of the pressure bc data structure.
Definition of the temperature bc data structure.
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.