15 EntityHandle prism_nodes[6] = {tri3_nodes[0], tri3_nodes[1], tri3_nodes[2],
16 tri4_nodes[0], tri4_nodes[1], tri4_nodes[2]};
20 std::swap(prism_nodes[1], prism_nodes[2]);
21 std::swap(prism_nodes[4], prism_nodes[5]);
24 std::swap(prism_nodes[0], prism_nodes[3]);
25 std::swap(prism_nodes[1], prism_nodes[4]);
26 std::swap(prism_nodes[2], prism_nodes[5]);
33 CHKERR m_field.
get_moab().create_element(MBPRISM, prism_nodes, 6, prism);
55 Range tris = ents.subset_by_type(MBTRI);
56 for (Range::iterator tit = tris.begin(); tit != tris.end(); tit++) {
59 CHKERR m_field.
get_moab().get_connectivity(*tit, conn, number_nodes,
false);
60 double coords[3 * number_nodes];
64 for (
int nn = 0; nn < 3; nn++) {
65 prism_face3[nn] = conn[nn];
69 CHKERR m_field.
get_moab().create_vertex(&coords[3 * nn], prism_face4[nn]);
80 CHKERR m_field.
get_moab().get_adjacencies(&prism, 1, 1,
true, edges,
81 moab::Interface::UNION);
83 CHKERR m_field.
get_moab().get_adjacencies(&prism, 1, 2,
true, faces,
84 moab::Interface::UNION);
86 for (
int ee = 0; ee <= 2; ee++) {
101 if (number_nodes > 3) {
105 for (
int ee = 0; ee <= 2; ee++) {
110 CHKERR m_field.
get_moab().convert_entities(meshset,
true,
false,
false);
113 int number_nodes_f4 = 0;
114 CHKERR m_field.
get_moab().get_connectivity(f4, conn_f4, number_nodes_f4,
116 if (number_nodes_f4 != number_nodes) {
118 "data inconsistency");
133 refined_entities_ptr =
135 if (!prisms.empty()) {
136 int dim = m_field.
get_moab().dimension_from_handle(prisms[0]);
137 for (
int dd = 0; dd <= dim; dd++) {
140 moab::Interface::UNION);
141 Range::iterator eit = ents.begin();
142 for (; eit != ents.end(); eit++) {
143 std::pair<RefEntity_multiIndex::iterator, bool> p_ent =
144 refined_entities_ptr->insert(boost::shared_ptr<RefEntity>(
146 *(
const_cast<RefEntity *
>(p_ent.first->get())->getBitRefLevelPtr()) |=
149 std::ostringstream ss;
150 ss << *(p_ent.first);
151 PetscSynchronizedPrintf(comm,
"%s\n", ss.str().c_str());
160 const Range &prisms,
bool from_down,
Range &out_prisms,
int verb) {
164 for (Range::iterator pit = prisms.begin(); pit != prisms.end(); pit++) {
178 const Range &prisms,
const double director3[],
const double director4[]) {
181 Range nodes_f3, nodes_f4;
182 for (Range::iterator pit = prisms.begin(); pit != prisms.end(); pit++) {
183 for (
int ff = 3; ff <= 4; ff++) {
187 int number_nodes = 0;
188 CHKERR m_field.
get_moab().get_connectivity(face, conn, number_nodes,
191 nodes_f3.insert(&conn[0], &conn[number_nodes]);
193 nodes_f4.insert(&conn[0], &conn[number_nodes]);
198 for (Range::iterator nit = nodes_f3.begin(); nit != nodes_f3.end(); nit++) {
200 cblas_daxpy(3, 1, director3, 1, coords, 1);
203 for (Range::iterator nit = nodes_f4.begin(); nit != nodes_f4.end(); nit++) {
205 cblas_daxpy(3, 1, director4, 1, coords, 1);
212 const Range &prisms,
double thickness3,
double thickness4) {
216 auto add_normal = [&](std::map<EntityHandle, std::array<double, 3>> &nodes,
221 CHKERR m_field.
get_moab().get_connectivity(face, conn, number_nodes,
false);
222 std::array<double, 9> coords;
223 CHKERR m_field.
get_moab().get_coords(conn, number_nodes, coords.data());
224 std::array<double, 3> normal;
226 double a = sqrt(normal[0] * normal[0] + normal[1] * normal[1] +
227 normal[2] * normal[2]);
228 for (
auto d : {0, 1, 2})
230 for (
auto n : {0, 1, 2}) {
232 for (
auto d : {0, 1, 2})
233 nodes.at(conn[
n])[d] += normal[d];
236 std::pair<
EntityHandle, std::array<double, 3>>(conn[
n], normal));
242 auto apply_map = [&](
auto &nodes,
double t) {
244 for (
auto &
m : nodes) {
245 std::array<double, 3> coords;
247 auto &normal =
m.second;
248 double a = sqrt(normal[0] * normal[0] + normal[1] * normal[1] +
249 normal[2] * normal[2]);
250 for (
auto d : {0, 1, 2})
251 coords[d] += (normal[d] /
a) *
t;
257 map<EntityHandle, std::array<double, 3>> nodes_f3, nodes_f4;
258 for (Range::iterator pit = prisms.begin(); pit != prisms.end(); pit++) {
259 for (
int ff = 3; ff <= 4; ff++) {
263 CHKERR add_normal(nodes_f3, face);
265 CHKERR add_normal(nodes_f4, face);
269 CHKERR apply_map(nodes_f3, thickness3);
270 CHKERR apply_map(nodes_f4, thickness4);
280 CHKERR m_field.
get_moab().get_adjacencies(prisms, 1,
true, prisms_edges,
281 moab::Interface::UNION);
283 CHKERR m_field.
get_moab().get_adjacencies(prisms, 2,
true, prisms_faces,
284 moab::Interface::UNION);
287 CHKERR m_field.
get_moab().get_entities_by_type(it->meshset, MBEDGE, edges,
289 edges = intersect(edges, prisms_edges);
290 if (!edges.empty()) {
292 CHKERR m_field.
get_moab().get_adjacencies(edges, 2,
false, edges_faces,
293 moab::Interface::UNION);
294 edges_faces = intersect(edges_faces, prisms_faces.subset_by_type(MBQUAD));
307 CHKERR m_field.
get_moab().get_adjacencies(prisms, 2,
true, prisms_tris,
308 moab::Interface::UNION);
309 prisms_tris = prisms_tris.subset_by_type(MBTRI);
312 CHKERR m_field.
get_moab().get_entities_by_type(it->meshset, MBTRI, tris,
314 tris = intersect(tris, prisms_tris);
317 CHKERR m_field.
get_moab().get_adjacencies(tris, 3,
false, tris_ents,
318 moab::Interface::UNION);
319 tris_ents = intersect(tris_ents, prisms);
#define MoFEMFunctionReturnHot(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 ...
@ MOFEM_DATA_INCONSISTENCY
#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 const RefEntity_multiIndex * get_ref_ents() const =0
Get the ref ents object.
#define _IT_CUBITMESHSETS_FOR_LOOP_(MESHSET_MANAGER, IT)
Iterator that loops over all the Cubit MeshSets in a moFEM field.
const double n
refractive index of diffusive medium
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
multi_index_container< boost::shared_ptr< RefEntity >, indexed_by< ordered_unique< tag< Ent_mi_tag >, const_mem_fun< RefEntity, EntityHandle, &RefEntity::getEnt > >, ordered_non_unique< tag< Ent_Ent_mi_tag >, const_mem_fun< RefEntity, EntityHandle, &RefEntity::getParentEnt > >, ordered_non_unique< tag< Composite_EntType_and_ParentEntType_mi_tag >, composite_key< RefEntity, const_mem_fun< RefEntity, EntityType, &RefEntity::getEntType >, const_mem_fun< RefEntity, EntityType, &RefEntity::getParentEntType > > >, ordered_non_unique< tag< Composite_ParentEnt_And_EntType_mi_tag >, composite_key< RefEntity, const_mem_fun< RefEntity, EntityType, &RefEntity::getEntType >, const_mem_fun< RefEntity, EntityHandle, &RefEntity::getParentEnt > > > > > RefEntity_multiIndex
RefEntityTmp< 0 > RefEntity
constexpr double t
plate stiffness
FTensor::Index< 'm', 3 > m
virtual moab::Interface & get_moab()=0
virtual MPI_Comm & get_comm() const =0
virtual boost::shared_ptr< BasicEntityData > & get_basic_entity_data_ptr()=0
Get pointer to basic entity data.
Tag get_th_RefParentHandle() const
Deprecated interface functions.
merge node from two bit levels
std::map< EntityHandle, EntityHandle > createdVertices
MoFEMErrorCode createPrism(const EntityHandle tri3_nodes[3], const EntityHandle tri4_nodes[3], const SwapType swap_type, EntityHandle &prism)
Create a prism from two triangle node triplets.
MoFEMErrorCode setNormalThickness(const Range &prisms, double thickness3, double thickness4)
MoFEMErrorCode createPrisms(const Range &ents, const SwapType swap_type, Range &prisms, int verb=-1)
Make prisms from triangles.
MoFEMErrorCode updateMeshestByEdgeBlock(const Range &prisms)
Add quads to bockset.
MoFEMErrorCode setThickness(const Range &prisms, const double director3[], const double director4[])
SwapType
List of types of node swapping performed on a created prism Node swapping is required to satisfy the ...
MoFEMErrorCode query_interface(boost::typeindex::type_index type_index, UnknownInterface **iface) const
MoFEMErrorCode seedPrismsEntities(Range &prisms, const BitRefLevel &bit, int verb=-1)
Seed prism entities by bit level.
MoFEMErrorCode createPrismsFromPrisms(const Range &prisms, bool from_down, Range &out_prisms, int verb=-1)
Make prisms by extruding top or bottom prisms.
MoFEMErrorCode updateMeshestByTriBlock(const Range &prisms)
Add prism to bockset.
Struct keeps handle to refined handle.
base class for all interface classes