13 {
14
16
17 try {
18
19 moab::Core mb_instance;
20 moab::Interface &moab = mb_instance;
21 int rank;
22 MPI_Comm_rank(PETSC_COMM_WORLD, &rank);
23
24 PetscBool flg = PETSC_TRUE;
26#if PETSC_VERSION_GE(3, 6, 4)
28 255, &flg);
29#else
32#endif
33 if (flg != PETSC_TRUE) {
34 SETERRQ(PETSC_COMM_SELF, 1, "*** ERROR -my_file (MESH FILE NEEDED)");
35 }
36
37
40
41 const char *option;
42 option = "";
44
45
47 bit_level0.set(0);
49 CHKERR moab.create_meshset(MESHSET_SET, meshset_level0);
51 0, 3, bit_level0);
52
53
56
57 {
58
59 const double coords[] = {0, 0, 0};
62 Range range_no_field_vertex;
63 range_no_field_vertex.insert(no_field_vertex);
67 CHKERR m_field.
get_moab().add_entities(meshset, range_no_field_vertex);
68 }
69
70
73
74
78
83
84
86
87
89 "TEST_FE1");
91 "TEST_FE2");
92
94
95
97
99
101 CHKERR moab.get_entities_by_type(0, MBTET, tets,
false);
104 CHKERR skin.find_skin(0, tets,
false, tets_skin);
106 "TEST_FE1");
108 "TEST_FE2");
109
110
111
112
118
119
120
121
123
126
128
130
134
135
136
137
140
142
143 typedef tee_device<std::ostream, std::ofstream>
TeeDevice;
145
146 std::ofstream ofs("forces_and_sources_testing_triangle_element.txt");
149
150 struct MyOp1 : public FaceElementForcesAndSourcesCore::UserDataOperator {
151
153 MyOp1(
TeeStream &_my_split,
const char type)
156 my_split(_my_split) {}
157
161
162 const double eps = 1e-4;
163 for (DoubleAllocator::iterator it = getNormal().data().begin();
164 it != getNormal().data().end(); it++) {
165 *it = fabs(*it) <
eps ? 0.0 : *it;
166 }
167
168 my_split << "NH1" << std::endl;
169 my_split <<
"side: " << side <<
" type: " <<
type << std::endl;
170 my_split << "data: " << data << std::endl;
171 my_split << std::setprecision(3) << getCoords() << std::endl;
172 my_split << std::setprecision(3) << getCoordsAtGaussPts() << std::endl;
173 my_split << std::setprecision(3) << getArea() << std::endl;
174 my_split << std::setprecision(3) << getNormal() << std::endl;
175 my_split << std::setprecision(3) << getNormalsAtGaussPts() << std::endl;
176 my_split << std::setprecision(3) << getTangent1AtGaussPts()
177 << std::endl;
178 my_split << std::setprecision(3) << getTangent2AtGaussPts()
179 << std::endl;
180 my_split << std::endl;
182 }
183
188
190 my_split << "NH1NH1" << std::endl;
191 my_split << "row side: " << row_side << " row_type: " << row_type
192 << std::endl;
193 my_split << row_data << std::endl;
194 my_split << "NH1NH1" << std::endl;
195 my_split << "col side: " << col_side << " col_type: " << col_type
196 << std::endl;
197 my_split << row_data << std::endl;
198
200 CHKERR getProblemRowIndices(
"FIELD1", row_type, row_side, row_indices);
201 CHKERR getProblemColIndices(
"FIELD1", col_type, col_side, col_indices);
202
203 if (row_indices.size() != row_data.
getIndices().size()) {
205 "row inconsistency");
206 }
207
208 if (col_indices.size() != col_data.
getIndices().size()) {
210 "col inconsistency");
211 }
212
213 for (unsigned int rr = 0; rr < row_indices.size(); rr++) {
214 if (row_indices[rr] != row_data.
getIndices()[rr]) {
215 std::cerr << row_indices << std::endl;
216 std::cerr << row_data.
getIndices() << std::endl;
218 "row inconsistency");
219 }
220 }
221
222 for (unsigned int cc = 0; cc < col_indices.size(); cc++) {
223 if (col_indices[cc] != col_data.
getIndices()[cc]) {
224 std::cerr << col_indices << std::endl;
225 std::cerr << col_data.
getIndices() << std::endl;
227 "row inconsistency");
228 }
229 }
230
231 my_split << row_data << std::endl;
232
234 }
235 };
236
237 struct MyOp2 :
public FaceElementForcesAndSourcesCore::UserDataOperator {
238
243 my_split(_my_split) {
245 }
246
250
251 if (type != MBENTITYSET)
253
254 my_split << "NOFIELD" << std::endl;
255 my_split <<
"side: " << side <<
" type: " <<
type << std::endl;
256 my_split << data << std::endl;
258 }
259
265
267
268 if (row_type != MBENTITYSET)
270
271 my_split << "NOFILEDH1" << std::endl;
272 my_split << "row side: " << row_side << " row_type: " << row_type
273 << std::endl;
274 my_split << row_data << std::endl;
275 my_split << "col side: " << col_side << " col_type: " << col_type
276 << std::endl;
277 my_split << col_data << std::endl;
278
280 }
281 };
282
284 fe1.getOpPtrVector().push_back(
285 new MyOp1(my_split, ForcesAndSourcesCore::UserDataOperator::OPROW));
286 fe1.getOpPtrVector().push_back(
287 new MyOp1(my_split, ForcesAndSourcesCore::UserDataOperator::OPROWCOL));
288
290 fe2.getOpPtrVector().push_back(
291 new MyOp2(my_split, ForcesAndSourcesCore::UserDataOperator::OPROW));
292 fe2.getOpPtrVector().push_back(
293 new MyOp2(my_split, ForcesAndSourcesCore::UserDataOperator::OPROWCOL));
294
297 }
299
301
302 return 0;
303}
ForcesAndSourcesCore::UserDataOperator UserDataOperator
#define CATCH_ERRORS
Catch errors.
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
@ NOFIELD
scalar or vector of scalars describe (no true field)
@ MOFEM_DATA_INCONSISTENCY
#define CHKERR
Inline error check.
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
virtual MoFEMErrorCode add_finite_element(const std::string &fe_name, enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)=0
add finite element
virtual MoFEMErrorCode build_finite_elements(int verb=DEFAULT_VERBOSITY)=0
Build finite elements.
virtual MoFEMErrorCode modify_finite_element_add_field_col(const std::string &fe_name, const std::string name_row)=0
set field col which finite element use
virtual MoFEMErrorCode add_ents_to_finite_element_by_type(const EntityHandle entities, const EntityType type, const std::string &name, const bool recursive=true)=0
add entities to finite element
virtual MoFEMErrorCode modify_finite_element_add_field_data(const std::string &fe_name, const std::string name_filed)=0
set finite element field data
virtual MoFEMErrorCode modify_finite_element_add_field_row(const std::string &fe_name, const std::string name_row)=0
set field row which finite element use
virtual MoFEMErrorCode build_fields(int verb=DEFAULT_VERBOSITY)=0
virtual MoFEMErrorCode set_field_order(const EntityHandle meshset, const EntityType type, const std::string &name, const ApproximationOrder order, int verb=DEFAULT_VERBOSITY)=0
Set order approximation of the entities in the field.
virtual MoFEMErrorCode add_ents_to_field_by_type(const Range &ents, const EntityType type, const std::string &name, int verb=DEFAULT_VERBOSITY)=0
Add entities to field meshset.
virtual MoFEMErrorCode loop_dofs(const Problem *problem_ptr, const std::string &field_name, RowColData rc, DofMethod &method, int lower_rank, int upper_rank, int verb=DEFAULT_VERBOSITY)=0
Make a loop over dofs.
virtual MoFEMErrorCode loop_finite_elements(const std::string problem_name, const std::string &fe_name, FEMethod &method, boost::shared_ptr< NumeredEntFiniteElement_multiIndex > fe_ptr=nullptr, MoFEMTypes bh=MF_EXIST, CacheTupleWeakPtr cache_ptr=CacheTupleSharedPtr(), int verb=DEFAULT_VERBOSITY)=0
Make a loop over finite elements.
MoFEMErrorCode partitionGhostDofs(const std::string name, int verb=VERBOSE)
determine ghost nodes
MoFEMErrorCode partitionSimpleProblem(const std::string name, int verb=VERBOSE)
partition problem dofs
MoFEMErrorCode buildProblem(const std::string name, const bool square_matrix, int verb=VERBOSE)
build problem data structures
MoFEMErrorCode partitionFiniteElements(const std::string name, bool part_from_moab=false, int low_proc=-1, int hi_proc=-1, int verb=VERBOSE)
partition finite elements
virtual MoFEMErrorCode add_problem(const std::string &name, enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)=0
Add problem.
virtual MoFEMErrorCode modify_problem_ref_level_add_bit(const std::string &name_problem, const BitRefLevel &bit)=0
add ref level to problem
virtual MoFEMErrorCode modify_problem_add_finite_element(const std::string name_problem, const std::string &fe_name)=0
add finite element to problem, this add entities assigned to finite element to a particular problem
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
UBlasVector< int > VectorInt
PetscErrorCode PetscOptionsGetString(PetscOptions *, const char pre[], const char name[], char str[], size_t size, PetscBool *set)
virtual moab::Interface & get_moab()=0
virtual EntityHandle get_field_meshset(const std::string name) const =0
get field meshset
virtual MoFEMErrorCode build_adjacencies(const Range &ents, int verb=DEFAULT_VERBOSITY)=0
build adjacencies
virtual MoFEMErrorCode add_field(const std::string &name, const FieldSpace space, const FieldApproximationBase base, const FieldCoefficientsNumber nb_of_coefficients, const TagType tag_type=MB_TAG_SPARSE, const enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)=0
Add field.
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.
bool sYmm
If true assume that matrix is symmetric structure.
void unSetSymm()
unset if operator is executed for non symmetric problem
Deprecated interface functions.
Data on single entity (This is passed as argument to DataOperator::doWork)
const VectorInt & getIndices() const
Get global indices of dofs on entity.
Problem manager is used to build and partition problems.
Projection of edge entities with one mid-node on hierarchical basis.
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface refernce to pointer of interface.
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.