namespace bio = boost::iostreams;
using bio::stream;
using bio::tee_device;
static char help[] =
"...\n\n";
int main(
int argc,
char *argv[]) {
try {
moab::Core mb_instance;
moab::Interface &moab = mb_instance;
PetscBool flg = PETSC_TRUE;
#if PETSC_VERSION_GE(3, 6, 4)
255, &flg);
#else
CHKERR PetscOptionsGetString(PETSC_NULL, PETSC_NULL,
"-my_file",
#endif
if (flg != PETSC_TRUE) {
SETERRQ(PETSC_COMM_SELF, 1, "*** ERROR -my_file (MESH FILE NEEDED)");
}
const char *option;
option = "";
std::vector<BitRefLevel> bit_levels;
int ll = 1;
CHKERR PetscPrintf(PETSC_COMM_WORLD,
"Insert Interface %d\n",
cit->getMeshsetId());
{
CHKERR moab.create_meshset(MESHSET_SET, ref_level_meshset);
;
->getEntitiesByTypeAndRefLevel(bit_levels.back(),
ref_level_meshset);
->getEntitiesByTypeAndRefLevel(bit_levels.back(),
ref_level_meshset);
CHKERR moab.get_entities_by_handle(ref_level_meshset, ref_level_tets,
true);
;
CHKERR interface->
getSides(cubit_meshset, bit_levels.back(),
true, 0);
cubit_meshset, true, true, 0);
CHKERR moab.delete_entities(&ref_level_meshset, 1);
;
}
->updateMeshsetByEntitiesChildren(cubit_meshset, bit_levels.back(),
cubit_meshset, MBMAXTYPE, true);
}
}
3);
{
const double coords[] = {0, 0, 0};
;
Range range_no_field_vertex;
range_no_field_vertex.insert(no_field_vertex);
CHKERR m_field.
get_moab().add_entities(meshset, range_no_field_vertex);
;
}
"MESH_NODE_POSITIONS");
"TEST_FE1");
"TEST_FE2");
bit_levels.back());
"MESH_NODE_POSITIONS");
"TEST_FE1", 10);
"TEST_FE2", 10);
1);
m_field, "MESH_NODE_POSITIONS");
CHKERR m_field.
loop_dofs(
"MESH_NODE_POSITIONS", ent_method_mesh_positions);
typedef tee_device<std::ostream, std::ofstream>
TeeDevice;
std::ofstream ofs("forces_and_sources_testing_flat_prism_element.txt");
"FIELD1", "FIELD1", type),
mySplit(mySplit) {}
for (DoubleAllocator::iterator it = getNormal().data().begin();
it != getNormal().data().end(); it++) {
*it = fabs(*it) <
eps ? 0.0 : *it;
}
for (DoubleAllocator::iterator it =
getNormalsAtGaussPtsF3().data().begin();
it != getNormalsAtGaussPtsF3().data().end(); it++) {
*it = fabs(*it) <
eps ? 0.0 : *it;
}
for (DoubleAllocator::iterator it =
getTangent1AtGaussPtF3().data().begin();
it != getTangent1AtGaussPtF3().data().end(); it++) {
*it = fabs(*it) <
eps ? 0.0 : *it;
}
for (DoubleAllocator::iterator it =
getTangent2AtGaussPtF3().data().begin();
it != getTangent2AtGaussPtF3().data().end(); it++) {
*it = fabs(*it) <
eps ? 0.0 : *it;
}
for (DoubleAllocator::iterator it =
getNormalsAtGaussPtsF4().data().begin();
it != getNormalsAtGaussPtsF4().data().end(); it++) {
*it = fabs(*it) <
eps ? 0.0 : *it;
}
for (DoubleAllocator::iterator it =
getTangent1AtGaussPtF4().data().begin();
it != getTangent1AtGaussPtF4().data().end(); it++) {
*it = fabs(*it) <
eps ? 0.0 : *it;
}
for (DoubleAllocator::iterator it =
getTangent2AtGaussPtF4().data().begin();
it != getTangent2AtGaussPtF4().data().end(); it++) {
*it = fabs(*it) <
eps ? 0.0 : *it;
}
mySplit << "NH1" << std::endl;
mySplit << "side: " << side << " type: " << type << std::endl;
mySplit << data << std::endl;
mySplit << std::setprecision(3) << getCoords() << std::endl;
mySplit << std::setprecision(3) << getArea(0) << std::endl;
mySplit << std::setprecision(3) << getArea(1) << std::endl;
mySplit << std::setprecision(3) << "normal F3 " << getNormalF3()
<< std::endl;
mySplit << std::setprecision(3) << "normal F4 " << getNormalF4()
<< std::endl;
mySplit << std::setprecision(3) << "normal at Gauss pt F3 "
<< getNormalsAtGaussPtsF3() << std::endl;
mySplit << std::setprecision(3) << getTangent1AtGaussPtF3()
<< std::endl;
mySplit << std::setprecision(3) << getTangent2AtGaussPtF3()
<< std::endl;
mySplit << std::setprecision(3) << "normal at Gauss pt F4 "
<< getNormalsAtGaussPtsF4() << std::endl;
mySplit << std::setprecision(3) << getTangent1AtGaussPtF4()
<< std::endl;
mySplit << std::setprecision(3) << getTangent2AtGaussPtF4()
<< std::endl;
}
mySplit << "NH1NH1" << std::endl;
mySplit << "row side: " << row_side << " row_type: " << row_type
<< std::endl;
mySplit << row_data << std::endl;
mySplit << "NH1NH1" << std::endl;
mySplit << "col side: " << col_side << " col_type: " << col_type
<< std::endl;
mySplit << row_data << std::endl;
}
};
"FIELD1", "FIELD2", type),
mySplit(my_split) {}
if (type != MBENTITYSET)
mySplit << "NOFIELD" << std::endl;
mySplit << "side: " << side << " type: " << type << std::endl;
mySplit << data << std::endl;
}
if (col_type != MBENTITYSET)
mySplit << "NOFILEDH1" << std::endl;
mySplit << "row side: " << row_side << " row_type: " << row_type
<< std::endl;
mySplit << row_data << std::endl;
mySplit << "col side: " << col_side << " col_type: " << col_type
<< std::endl;
mySplit << col_data << std::endl;
}
};
new MyOp(my_split, ForcesAndSourcesCore::UserDataOperator::OPROW));
new MyOp(my_split, ForcesAndSourcesCore::UserDataOperator::OPROWCOL));
new MyOp2(my_split, ForcesAndSourcesCore::UserDataOperator::OPCOL));
new MyOp2(my_split, ForcesAndSourcesCore::UserDataOperator::OPROWCOL));
}
return 0;
}
#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)
#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.
#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
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.
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 VectorDouble & getFieldData() const
get dofs values
default operator for Flat Prism element
FlatPrism finite element.
MatrixDouble & getCoordsAtGaussPts()
Gauss points and weight, matrix (nb. of points x 3)
boost::ptr_deque< UserDataOperator > & getOpPtrVector()
Use to push back operator for row operator.
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 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.
Operator used to check consistency between local coordinates and global cooridnates for integrated po...
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.