5namespace bio = boost::iostreams;
9typedef tee_device<std::ostream, std::ofstream>
TeeDevice;
14static char help[] =
"...\n\n";
19 MyOp(
const char type,
const char face_type)
21 "FIELD1",
"FIELD1", type, face_type),
31 MOFEM_LOG(
"ATOM_TEST", Sev::inform) <<
"NH1";
33 <<
"side: " << side <<
" type: " << type;
34 MOFEM_LOG(
"ATOM_TEST", Sev::inform) << data;
38 <<
"coords Master " << std::fixed << std::setprecision(2)
41 <<
"area Master " << std::fixed << std::setprecision(2)
44 <<
"normal Master " << std::fixed << std::setprecision(2)
47 <<
"coords at Gauss Pts Master " << std::fixed
51 <<
"coords Slave " << std::fixed << std::setprecision(2)
54 <<
"area Slave " << std::fixed << std::setprecision(2)
57 <<
"normal Slave " << std::fixed << std::setprecision(2)
60 <<
"coords at Gauss Pts Slave " << std::fixed
75 MOFEM_LOG(
"ATOM_TEST", Sev::inform) <<
"NH1NH1";
77 <<
"row side: " << row_side <<
" row_type: " << row_type;
78 MOFEM_LOG(
"ATOM_TEST", Sev::inform) << row_data;
79 MOFEM_LOG(
"ATOM_TEST", Sev::inform) <<
"NH1NH1";
81 <<
"col side: " << col_side <<
" col_type: " << col_type;
82 MOFEM_LOG(
"ATOM_TEST", Sev::inform) << col_data;
88struct CallingOp :
public ForcesAndSourcesCore::UserDataOperator {
100 MOFEM_LOG(
"ATOM_TEST", Sev::inform) <<
"Calling Operator NH1";
102 <<
"side: " << side <<
" type: " << type;
103 MOFEM_LOG(
"ATOM_TEST", Sev::inform) << data;
117 MOFEM_LOG(
"ATOM_TEST", Sev::inform) <<
"Calling Operator NH1NH1";
119 <<
"row side: " << row_side <<
" row_type: " << row_type;
120 MOFEM_LOG(
"ATOM_TEST", Sev::inform) << row_data;
121 MOFEM_LOG(
"ATOM_TEST", Sev::inform) <<
"NH1NH1";
123 <<
"col side: " << col_side <<
" col_type: " << col_type;
124 MOFEM_LOG(
"ATOM_TEST", Sev::inform) << col_data;
130int main(
int argc,
char *argv[]) {
136 moab::Core mb_instance;
137 moab::Interface &moab = mb_instance;
139 PetscBool flg = PETSC_TRUE;
143 if (flg != PETSC_TRUE)
146 enum spaces { MYH1, MYHDIV, MYLASTSPACEOP };
147 const char *list_spaces[] = {
"h1",
"hdiv"};
148 PetscInt choice_space_value =
H1;
150 MYLASTSPACEOP, &choice_space_value, &flg);
151 bool is_hdiv = (choice_space_value == MYHDIV) ?
true :
false;
158 auto add_atom_logging = [is_hdiv]() {
160 auto get_log_file_name = [is_hdiv]() {
162 return "forces_and_sources_testing_contact_prism_element_HDIV.txt";
164 return "forces_and_sources_testing_contact_prism_element.txt";
167 auto core_log = logging::core::get();
174 logging::add_file_log(keywords::file_name = get_log_file_name(),
176 MoFEM::LogKeywords::channel ==
"ATOM_TEST");
180 CHKERR add_atom_logging();
191 std::vector<BitRefLevel> bit_levels;
197 CHKERR PetscPrintf(PETSC_COMM_WORLD,
"Insert Interface %d\n",
198 cit->getMeshsetId());
203 CHKERR moab.create_meshset(MESHSET_SET, ref_level_meshset);
205 ->getEntitiesByTypeAndRefLevel(bit_levels.back(),
209 ->getEntitiesByTypeAndRefLevel(bit_levels.back(),
212 Range ref_level_tets;
213 CHKERR moab.get_entities_by_handle(ref_level_meshset, ref_level_tets,
216 CHKERR interface->
getSides(cubit_meshset, bit_levels.back(),
true, 0);
221 cubit_meshset,
true,
true, 0);
223 CHKERR moab.delete_entities(&ref_level_meshset, 1);
229 ->updateMeshsetByEntitiesChildren(cubit_meshset, bit_levels.back(),
230 cubit_meshset, MBMAXTYPE,
true);
251 "MESH_NODE_POSITIONS");
268 "MESH_NODE_POSITIONS");
274 constexpr int order = 3;
301 m_field,
"MESH_NODE_POSITIONS");
302 CHKERR m_field.
loop_dofs(
"MESH_NODE_POSITIONS", ent_method_mesh_positions);
320 using UMDataOp = ForcesAndSourcesCore::UserDataOperator;
321 using ContactDataOp =
326 new MyOp(UMDataOp::OPROW, ContactDataOp::FACEMASTER));
328 new MyOp(UMDataOp::OPROW, ContactDataOp::FACESLAVE));
330 new MyOp(UMDataOp::OPROWCOL, ContactDataOp::FACEMASTERMASTER));
332 new MyOp(UMDataOp::OPROWCOL, ContactDataOp::FACEMASTERSLAVE));
334 new MyOp(UMDataOp::OPROWCOL, ContactDataOp::FACESLAVEMASTER));
336 new MyOp(UMDataOp::OPROWCOL, ContactDataOp::FACESLAVESLAVE));
ForcesAndSourcesCore::UserDataOperator UserDataOperator
#define CATCH_ERRORS
Catch errors.
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base nme:nme847.
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
@ HDIV
field with continuous normal traction
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#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_row(const std::string &fe_name, const std::string name_row)=0
set field row which finite element use
virtual MoFEMErrorCode modify_finite_element_add_field_data(const std::string &fe_name, const std::string name_field)=0
set finite element field data
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.
static LoggerType & setLog(const std::string channel)
Set ans resset chanel logger.
#define MOFEM_LOG(channel, severity)
Log.
#define MOFEM_LOG_TAG(channel, tag)
Tag channel.
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.
#define _IT_CUBITMESHSETS_FOR_LOOP_(MESHSET_MANAGER, IT)
Iterator that loops over all the Cubit MeshSets in a moFEM field.
#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.
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.
implementation of Data Operators for Forces and Sources
PetscErrorCode PetscOptionsGetEList(PetscOptions *, const char pre[], const char name[], const char *const *list, PetscInt next, PetscInt *value, PetscBool *set)
PetscErrorCode PetscOptionsGetString(PetscOptions *, const char pre[], const char name[], char str[], size_t size, PetscBool *set)
CallingOp(const char type)
MoFEMErrorCode doWork(int row_side, int col_side, EntityType row_type, EntityType col_type, EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
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)
const VectorDouble & getFieldData() const
get dofs values
structure to get information form mofem into EntitiesFieldData
boost::ptr_deque< UserDataOperator > & getOpPtrVector()
Use to push back operator for row operator.
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.
Create interface from given surface and insert flat prisms in-between.
MoFEMErrorCode getSides(const int msId, const CubitBCType cubit_bc_type, const BitRefLevel mesh_bit_level, const bool recursive, int verb=QUIET)
Store tetrahedra from each side of the interface separately in two child meshsets of the parent meshs...
MoFEMErrorCode splitSides(const EntityHandle meshset, const BitRefLevel &bit, const int msId, const CubitBCType cubit_bc_type, const bool add_interface_entities, const bool recursive=false, int verb=QUIET)
Split nodes and other entities of tetrahedra on both sides of the interface and insert flat prisms in...
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 reference to pointer of interface.
Operator used to check consistency between local coordinates and global cooridnates for integrated po...
MyOp(const char type, const char face_type)
MoFEMErrorCode doWork(int row_side, int col_side, EntityType row_type, EntityType col_type, EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
Operator for bi-linear form, usually to calculate values on left hand side.
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.