|
| v0.14.0
|
Go to the documentation of this file.
11 using namespace MoFEM;
13 static char help[] =
"testing mesh cut test\n\n";
23 <<
"bit_level nb ents " <<
bit <<
" " << ents.size();
24 if (expected_size != -1 && expected_size !=
static_cast<int>(ents.size())) {
26 "Wrong bit ref size %d!=%d", expected_size, ents.size());
32 int main(
int argc,
char *argv[]) {
40 PetscBool flg = PETSC_TRUE;
45 if (flg != PETSC_TRUE)
47 "*** ERROR -my_file (MESH FILE NEEDED)");
53 int restricted_side_set = 205;
55 &restricted_side_set, PETSC_NULL);
57 double shift[] = {0, 0, 0};
62 "three values expected");
64 int fixed_edges_blockset = 100;
66 &fixed_edges_blockset, PETSC_NULL);
68 int corner_nodes_blockset = 1;
70 &corner_nodes_blockset, PETSC_NULL);
72 double tol[] = {0, 0, 0};
75 if (flg && nmax_tol != 3)
78 PetscBool test = PETSC_FALSE;
84 ParallelComm *pcomm = ParallelComm::get_pcomm(&moab,
MYPCOMM_INDEX);
86 boost::make_shared<WrapMPIComm>(PETSC_COMM_WORLD,
false);
89 new ParallelComm(&moab, moab_comm_wrap->get_comm());
116 bit_level0,
BitRefLevel().set(), MBTET,
"out_tets_init_level0.vtk",
119 bit_last,
BitRefLevel().set(), MBTET,
"out_tets_bit_last.vtk",
"VTK",
122 int no_of_ents_not_in_database = -1;
123 Range ents_not_in_database;
126 ents_not_in_database);
127 no_of_ents_not_in_database = ents_not_in_database.size();
141 Range fixed_edges, corner_nodes;
144 fixed_edges_blockset,
SIDESET, 1, fixed_edges,
true);
148 fixed_edges_blockset,
BLOCKSET, 1, fixed_edges,
true);
152 corner_nodes_blockset,
BLOCKSET, 0, corner_nodes,
true);
156 Range restriced_surface;
159 restricted_side_set,
SIDESET, 2, restriced_surface,
true);
179 CHKERR moab.get_entities_by_dimension(0, 3, tets,
false);
184 const int nb_ref_cut = 1;
185 const int nb_ref_trim = 1;
188 auto shift_after_ref = [&]() {
192 for (
int ll = 1; ll != nb_ref_cut + nb_ref_trim + 1; ++ll)
195 nb_ref_cut + nb_ref_trim, mask,
VERBOSE);
201 ->writeEntitiesAllBitLevelsByType(
BitRefLevel().set(), MBTET,
202 "all_bits.vtk",
"VTK",
"");
205 double def_position[] = {0, 0, 0};
207 CHKERR moab.tag_get_handle(
"POSITION", 3, MB_TYPE_DOUBLE,
th,
208 MB_TAG_CREAT | MB_TAG_SPARSE, def_position);
215 fixed_edges, corner_nodes,
true,
false);
222 ->updateAllMeshsetsByEntitiesChildren(
BitRefLevel().set(first_bit + 1));
226 "out_split_tets.vtk",
"VTK",
"");
230 "out_split_prism.vtk",
"VTK",
"");
233 for (
int ll = 0; ll != first_bit + 2; ++ll)
240 for (
int ll = 0; ll != first_bit; ++ll)
243 first_bit, shift_mask,
VERBOSE);
249 "out_tets_shift_level0.vtk",
"VTK",
"");
252 "out_tets_shift_level1.vtk",
"VTK",
"");
255 "out_tets_shift_level1_prism.vtk",
"VTK",
"");
259 Range adj_surface_edges;
261 adj_surface_edges, moab::Interface::UNION);
263 CHKERR moab.delete_entities(adj_surface_edges);
264 CHKERR moab.delete_entities(surface_verts);
271 CHKERR moab.create_meshset(MESHSET_SET, meshset);
273 CHKERR moab.get_entities_by_dimension(0, 3, tets,
true);
274 CHKERR moab.add_entities(meshset, tets);
275 CHKERR moab.write_file(
"out.vtk",
"VTK",
"", &meshset, 1);
276 CHKERR moab.delete_entities(&meshset, 1);
279 bit_last,
BitRefLevel().set(), MBTET,
"out_tets_bit_last.vtk",
"VTK",
282 "left_entities.vtk",
"VTK",
"");
288 if (no_of_ents_not_in_database !=
static_cast<int>(ents.size())) {
289 MOFEM_LOG(
"WORLD", Sev::inform) << subtract(ents, ents_not_in_database);
291 CHKERR moab.create_meshset(MESHSET_SET, meshset);
293 CHKERR moab.get_entities_by_dimension(0, 3, tets,
true);
294 CHKERR moab.add_entities(meshset, subtract(ents, ents_not_in_database));
295 CHKERR moab.write_file(
"not_cleanded.vtk",
"VTK",
"", &meshset, 1);
296 CHKERR moab.delete_entities(&meshset, 1);
298 "Inconsistent number of ents %d!=%d",
299 no_of_ents_not_in_database, ents.size());
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
#define MYPCOMM_INDEX
default communicator number PCOMM
MoFEMErrorCode getEntitiesByRefLevel(const BitRefLevel bit, const BitRefLevel mask, const EntityHandle meshset, const int verb=QUIET) const
add all ents from ref level given by bit to meshset
#define MOFEM_LOG_CHANNEL(channel)
Set and reset channel.
MoFEMErrorCode setVolume(const Range volume)
set volume entities
MoFEMErrorCode setCoords(Tag th, const BitRefLevel bit=BitRefLevel(), const BitRefLevel mask=BitRefLevel().set())
set coords from tag
MoFEMErrorCode makeFront(const bool debug=false)
Create front from the surface.
MoFEMErrorCode setTagData(Tag th, const BitRefLevel bit=BitRefLevel())
set coords to tag
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
MoFEMErrorCode copySurface(const Range surface, Tag th=NULL, double *shift=NULL, double *origin=NULL, double *transform=NULL, const std::string save_mesh="")
copy surface entities
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
DeprecatedCoreInterface Interface
#define CHKERR
Inline error check.
MoFEMErrorCode cutTrimAndMerge(int &first_bit, const int fraction_level, Tag th, const double tol_geometry, const double tol_cut_close, const double tol_trim_close, Range &fixed_edges, Range &corner_nodes, const bool update_meshsets=false, const bool debug=false)
Cut, trim and merge.
implementation of Data Operators for Forces and Sources
const Range & getMergedSurfaces() const
MoFEMErrorCode getEntitiesByDimension(const int ms_id, const unsigned int cubit_bc_type, const int dimension, Range &entities, const bool recursive=true) const
get entities from CUBIT/meshset of a particular entity dimension
def surface(x, y, z, eta)
MoFEMErrorCode setConstrainSurface(const Range surf)
Set the constrain surface object.
virtual MoFEMErrorCode delete_ents_by_bit_ref(const BitRefLevel bit, const BitRefLevel mask, const bool remove_parent=false, int verb=DEFAULT_VERBOSITY, MoFEMTypes mf=MF_ZERO)=0
delete entities form mofem and moab database
MoFEMErrorCode setSurface(const Range surface)
set surface entities
MoFEMErrorCode buildTree()
build tree
PetscErrorCode PetscOptionsGetRealArray(PetscOptions *, const char pre[], const char name[], PetscReal dval[], PetscInt *nmax, PetscBool *set)
static MoFEMErrorCode Initialize(int *argc, char ***args, const char file[], const char help[])
Initializes the MoFEM database PETSc, MOAB and MPI.
#define MOFEM_LOG(channel, severity)
Log.
#define CATCH_ERRORS
Catch errors.
#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 refineMesh(const int init_bit_level, const int surf_levels, const int front_levels, Range *fixed_edges=nullptr, int verb=QUIET, const bool debug=false)
Refine and set level sets.
#define BITREFLEVEL_SIZE
max number of refinements
PetscErrorCode PetscOptionsGetString(PetscOptions *, const char pre[], const char name[], char str[], size_t size, PetscBool *set)
Interface for managing meshsets containing materials and boundary conditions.
MoFEMErrorCode splitSides(const BitRefLevel split_bit, const BitRefLevel bit, const Range &ents, Tag th=NULL)
split sides
MoFEMErrorCode operator()(const BitRefLevel &bit, const int expected_size)
int main(int argc, char *argv[])
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
@ MOFEM_ATOM_TEST_INVALID
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
bool checkMeshset(const int ms_id, const CubitBCType cubit_bc_type) const
check for CUBIT Id and CUBIT type
PetscErrorCode PetscOptionsGetInt(PetscOptions *, const char pre[], const char name[], PetscInt *ivalue, PetscBool *set)
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
const Range & getSurface() const
TestBitLevel(BitRefManager *mng_ptr)
PetscErrorCode PetscOptionsGetBool(PetscOptions *, const char pre[], const char name[], PetscBool *bval, PetscBool *set)