Simple user data operator which main purpose is to print values of base functions at intergation points.
168 {
169
170
172
173 try {
174
175
176 moab::Core mb_instance;
177
178 moab::Interface &moab = mb_instance;
179
180
181 PetscBool flg = PETSC_TRUE;
183#if PETSC_VERSION_GE(3, 6, 4)
185 255, &flg);
186#else
189#endif
190 if (flg != PETSC_TRUE) {
192 "*** ERROR -my_file (MESH FILE NEEDED)");
193 }
194
195
197
199
200
201 const char *option;
202 option = "";
204
205
208
209
210
211
214
215
217
218
219 auto field_order_table =
220 const_cast<Field *
>(field_ptr)->getFieldOrderTable();
221
222
223 auto get_cgg_bubble_order_zero = [](
int p) {
return 0; };
224
225 auto get_cgg_bubble_order_face = [](
int p) {
227 };
228 auto get_cgg_bubble_order_tet = [](
int p) {
230 };
231 field_order_table[MBVERTEX] = get_cgg_bubble_order_zero;
232 field_order_table[MBEDGE] = get_cgg_bubble_order_zero;
233 field_order_table[MBTRI] = get_cgg_bubble_order_face;
234 field_order_table[MBTET] = get_cgg_bubble_order_tet;
235 const_cast<Field *
>(field_ptr)->rebuildDofsOrderMap();
236
238 for(
auto d = 0;
d!=10; ++
d) {
239 MOFEM_LOG(
"WORLD", Sev::noisy) <<
"dof " << dof_order_map[
d];
240 }
241
243
244
251
252
254
255
257
260
261
263
266
268
269
275
276
277
278
280
282
284
285
287 true);
288
290 "PROBLEM");
292 "PROBLEM");
293
295 "PROBLEM");
296
297 typedef tee_device<std::ostream, std::ofstream>
TeeDevice;
299
300 std::ofstream ofs("forces_and_sources_testing_users_base.txt");
303
304
305
306
307
308
309 struct MyOp1 : public VolumeElementForcesAndSourcesCore::UserDataOperator {
310
312 MyOp1(const std::string &row_filed, const std::string &col_field,
315 row_filed, col_field,
type),
316 my_split(_my_split) {
317 sYmm = false;
318 }
319
325 }
326 my_split << rowFieldName << endl;
327 my_split <<
"side: " << side <<
" type: " <<
type << std::endl;
328 my_split << data << endl;
329 my_split << data.
getN() << endl;
330 my_split << endl;
332 }
333
343 my_split << rowFieldName << " : " << colFieldName << endl;
344 my_split << "row side: " << row_side << " row_type: " << row_type
345 << std::endl;
346 my_split << "col side: " << col_side << " col_type: " << col_type
347 << std::endl;
348 my_split << row_data.
getIndices().size() <<
" : "
350 my_split << endl;
352 }
353 };
354
355
357
358 fe1.getUserPolynomialBase() =
360
361
362 fe1.getOpPtrVector().push_back(
363 new MyOp1("FILED_CGG", "FILED_CGG", my_split,
364 ForcesAndSourcesCore::UserDataOperator::OPROW));
365 fe1.getOpPtrVector().push_back(
366 new MyOp1("FILED_CGG", "FILED_RT", my_split,
367 ForcesAndSourcesCore::UserDataOperator::OPROWCOL));
368
369
370
372 }
374
376
377 return 0;
378}
ForcesAndSourcesCore::UserDataOperator UserDataOperator
#define CATCH_ERRORS
Catch errors.
@ USER_BASE
user implemented approximation base
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
@ HDIV
field with continuous normal traction
@ 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 const Field * get_field_structure(const std::string &name, enum MoFEMTypes bh=MF_EXIST) const =0
get field structure
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.
#define MOFEM_LOG(channel, severity)
Log.
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.
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
#define NBVOLUMETET_DEMKOWICZ_HDIV(P)
#define NBFACETRI_DEMKOWICZ_HDIV(P)
const Tensor1_Expr< const dTensor0< T, Dim, i >, typename promote< T, double >::V, Dim, i > d(const Tensor0< T * > &a, const Index< i, Dim > index, const Tensor1< int, Dim > &d_ijk, const Tensor1< double, Dim > &d_xyz)
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
PetscErrorCode PetscOptionsGetString(PetscOptions *, const char pre[], const char name[], char str[], size_t size, PetscBool *set)
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.
Deprecated interface functions.
Data on single entity (This is passed as argument to DataOperator::doWork)
MatrixDouble & getN(const FieldApproximationBase base)
get base functions this return matrix (nb. of rows is equal to nb. of Gauss pts, nb....
const VectorInt & getIndices() const
Get global indices of dofs on entity.
Provide data structure for (tensor) field approximation.
const std::array< ApproximationOrder, MAX_DOFS_ON_ENTITY > & getDofOrderMap(const EntityType type) const
get hash-map relating dof index on entity with its order
Problem manager is used to build and partition problems.
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface refernce to pointer of interface.
Volume finite element base.
Class used to calculate base functions at integration points.