BELFEM 0.9.0
Berkeley Lab Finite Element Framework
Loading...
Searching...
No Matches
cl_Mesh.hpp
Go to the documentation of this file.
1/*
2 * BELFEM -- The Berkeley Lab Finite Element Framework
3 * Copyright (c) 2026, The Regents of the University of California,
4 * through Lawrence Berkeley National Laboratory (subject to receipt of any required
5 * approvals from the U.S. Dept. of Energy). All rights reserved.
6 *
7 * Developers: Christian Messe, Gregory Giard
8 *
9 * See the top-level LICENSE file for the complete license and disclaimer.
10 */
11
12#ifndef BELFEM_CL_MESH_HPP
13#define BELFEM_CL_MESH_HPP
14
15#include "typedefs.hpp"
16#include "cl_Hash.hpp"
17#include "cl_Cell.hpp"
18#include "cl_Map.hpp"
19#include "cl_Element.hpp"
20#include "cl_Node.hpp"
21#include "cl_Facet.hpp"
22#include "cl_Face.hpp"
23#include "cl_ControlPoint.hpp"
24#include "cl_Block.hpp"
25#include "cl_SideSet.hpp"
27#include "cl_Mesh_Field.hpp"
28#include "cl_ThinShell.hpp"
29#include "cl_Curve.hpp"
30#include "cl_Bitset.hpp"
31#include "cl_DynamicBitset.hpp"
34#include "hdf5_types.hpp"
35
36namespace belfem
37{
38//------------------------------------------------------------------------------
39
40 namespace mesh
41 {
42 class ProtoMesh ;
43
44 class PeriodicityFactory ;
45
46 class GmshReader;
47
48 uint
49 compute_facet_index( Facet * aFacet, Element * aElement, Cell< Node * > & aNodes );
50 }
51
52
59 class Mesh
60 {
61//------------------------------------------------------------------------------
62 protected:
63//------------------------------------------------------------------------------
64
65 // master proc that owns this mesh, default: 0
69
70
71 // hash value for unique fingerprint, must be computed first
72 // refers to original unaltered mesh without cuts and thin shells
74
80 uint64_t mConfigTag = 0 ;
81 string mConfigText ;
82
83 string mPath ;
84
87 Cell< mesh::Facet * > mFacets; // facets refer to sidesets
88 Cell< mesh::Element * > mVertices; // not to be confused with mesh vertex
92
94
101
106
109
113
114 // how many partitions is this mesh split into?
116
120
122 uint mTimeStep = 1; // << -- timestep is 1-based for exodus compatibility
123
124
125 friend class mesh::GmshReader;
127 friend class mesh::ProtoMesh;
128
139
140 // maximum element order
142
144 bool mIsKernelMesh = false ;
145
147 bool mIsFinalized = false ;
148 bool mEdgesAreFinalized = false ;
149 bool mFacesAreFinalized = false ;
150
151 // we only call the symrcm once per mesh
152 bool mNodesAreSorted = false ;
153
154 // compute orientations on finalize
156
159
162
165
167
168 const TensorMeshConfig * mTensorConfig = nullptr ;
169
171
172 bool mMeshCheckerFlag = false ;
173
174//------------------------------------------------------------------------------
175 public:
176//------------------------------------------------------------------------------
177
181 Mesh( const uint aNumberOfDimensions, const proc_t aMasterProc=0, const bool aComputeConnectivities = true );
182
183//------------------------------------------------------------------------------
184
188 Mesh( const string & aPath,
189 const proc_t aMasterProc = 0,
190 const bool aComputeConnectivities = true,
191 const bool aParallelMode = true );
192
193//------------------------------------------------------------------------------
194
199 Mesh( const uint aOrder,
200 const Vector< index_t > aNumNodes,
201 const Vector< real > aStep,
202 const Vector< real > aOrigin = {},
203 const proc_t aMasterProc = 0 );
204
205//------------------------------------------------------------------------------
206
210 void
211 scale_mesh( const real aFactor );
212
213//------------------------------------------------------------------------------
214
215 ~Mesh();
216
217//------------------------------------------------------------------------------
218
219 const string &
220 path() const ;
221
222//------------------------------------------------------------------------------
223
224 bool
225 is_tensormesh() const ;
226
227//------------------------------------------------------------------------------
228
229 const TensorMeshConfig *
230 tensorconf() const;
231
232//------------------------------------------------------------------------------
233
234 void
235 save( const string & aFilePath );
236
237//------------------------------------------------------------------------------
238
239 uint
240 number_of_dimensions() const;
241
242//------------------------------------------------------------------------------
243
244 void
245 set_number_of_dimensions( const uint & aNumberOfDimensions );
246
247//------------------------------------------------------------------------------
248
249 index_t
250 number_of_nodes() const;
251
252//------------------------------------------------------------------------------
253
254 index_t
255 number_of_elements() const;
256
257//------------------------------------------------------------------------------
258
259 index_t
260 number_of_facets() const;
261
262//------------------------------------------------------------------------------
263
264 index_t
265 number_of_edges() const;
266
267//------------------------------------------------------------------------------
268
269 index_t
270 number_of_faces() const;
271
272//------------------------------------------------------------------------------
273
274 index_t
276
277//------------------------------------------------------------------------------
278
279 uint
280 number_of_blocks() const;
281
282//------------------------------------------------------------------------------
283
284 uint
285 number_of_fields() const;
286
287//------------------------------------------------------------------------------
288
289 uint
291
292//------------------------------------------------------------------------------
293
294 mesh::Node *
295 node( const id_t aID );
296
297//------------------------------------------------------------------------------
298
299 mesh::Node *
300 node( const index_t i, const index_t j );
301
302//------------------------------------------------------------------------------
303
304 mesh::Node *
305 node( const index_t i, const index_t j, const index_t k );
306
307//------------------------------------------------------------------------------
308
309 mesh::Edge *
310 edge( const id_t aID );
311
312//------------------------------------------------------------------------------
313
314 mesh::Face *
315 face( const id_t aID );
316
317//------------------------------------------------------------------------------
318
319 bool
320 element_exists( const id_t aID ) const;
321
323 element( const id_t aID );
324
326 element( const index_t i, const index_t j );
327
329 element( const index_t i, const index_t j, const index_t k );
330
331//------------------------------------------------------------------------------
332
334 control_point( const id_t aID );
335
337 control_point( const index_t i, const index_t j );
338
340 control_point( const index_t i, const index_t j, const index_t k );
341
342//------------------------------------------------------------------------------
343
344 bool
345 facet_exists( const id_t aID ) const;
346
348 facet( const id_t aID );
349
350//------------------------------------------------------------------------------
351
353 block( const id_t aID );
354
355//------------------------------------------------------------------------------
356
358 sideset( const id_t aID );
359
360//------------------------------------------------------------------------------
361
363 vertex( const id_t aID );
364
365//------------------------------------------------------------------------------
366
368 basis_by_index( const EntityType aType, const index_t aIndex );
369
371 basis( const EntityType aType, const id_t aID );
372
373//------------------------------------------------------------------------------
374
379 field( const string & aLabel );
380
381//------------------------------------------------------------------------------
382
384 field( const index_t aIndex );
385
386//------------------------------------------------------------------------------
387
388 // test if a field has already been created
389 bool
390 field_exists( const string & aLabel );
391
392//------------------------------------------------------------------------------
393
395 field_data( const string & aLabel );
396
397//------------------------------------------------------------------------------
398
401
402//------------------------------------------------------------------------------
403
405 global_variable( const id_t aID );
406
407//------------------------------------------------------------------------------
408
410 global_variable( const string & aLabel );
411
412//------------------------------------------------------------------------------
413
414 real &
415 global_variable_data( const string & aLabel );
416
417//------------------------------------------------------------------------------
418
419 // test if a global variable has already been created
420 bool
421 global_variable_exists( const string & aLabel );
422
423//------------------------------------------------------------------------------
424
425 uint
426 number_of_sidesets() const;
427
428//------------------------------------------------------------------------------
429
436
437 index_t
439
440//------------------------------------------------------------------------------
441
442 void
443 add_block( mesh::Block * aBlock );
444
445//------------------------------------------------------------------------------
446
447 void
448 add_sideset( mesh::SideSet * aSideSet );
449
450//------------------------------------------------------------------------------
451
454 const string & aLabel,
455 const EntityType aEntity=EntityType::NODE,
456 const id_t aID = 0 );
457
458//------------------------------------------------------------------------------
459
460 real &
461 create_global_variable( const string & aLabel,
462 const real aValue = 0.0,
463 const id_t aID = 0 );
464
465//------------------------------------------------------------------------------
466
467 void
469
470//------------------------------------------------------------------------------
471
472 void
474
475//------------------------------------------------------------------------------
476
477 void
479
480//------------------------------------------------------------------------------
481
482 void
484 Cell< mesh::Element * > & aElements,
485 const id_t aGroupId,
486 const ElementType aType = ElementType::EMPTY );
487
488//------------------------------------------------------------------------------
489
490 void
492
493//------------------------------------------------------------------------------
494
499 void
500 finalize();
501
502//------------------------------------------------------------------------------
503
504 bool
505 is_finalized() const ;
506
507 bool
508 edges_are_finalized() const ;
509
510 bool
511 faces_are_finalized() const ;
512
513//------------------------------------------------------------------------------
514
515 void
517
518//------------------------------------------------------------------------------
519
520 void
522
523//------------------------------------------------------------------------------
524
528 void
529 unfinalize();
530
531//------------------------------------------------------------------------------
532
533 void
535
536//------------------------------------------------------------------------------
537
538 void
540
541//------------------------------------------------------------------------------
542
543 void
545
546//------------------------------------------------------------------------------
547
548 void
549 unflag_everything( const uint aFlagIndex=0 );
550
551//------------------------------------------------------------------------------
552
553 void
554 unflag_all_nodes( const uint aFlagIndex=0 );
555
556//------------------------------------------------------------------------------
557
558 void
559 unflag_all_edges( const uint aFlagIndex=0 );
560
561//------------------------------------------------------------------------------
562
563 void
564 unflag_all_faces( const uint aFlagIndex=0 );
565
566//------------------------------------------------------------------------------
567
568 void
569 unflag_all_facets( const uint aFlagIndex=0 );
570
571//------------------------------------------------------------------------------
572
573 void
574 unflag_all_elements( const uint aFlagIndex=0 );
575
576//------------------------------------------------------------------------------
577
578 void
579 unflag_all_vertices( const uint aFlagIndex=0 );
580
581//------------------------------------------------------------------------------
582
583 void
584 unflag_all_control_points( const uint aFlagIndex=0 );
585
586//------------------------------------------------------------------------------
587
592 nodes();
593
594//------------------------------------------------------------------------------
595
600 blocks();
601
602//------------------------------------------------------------------------------
603
607 bool
608 block_exists( const id_t aID ) const ;
609
610//------------------------------------------------------------------------------
611
615 bool
616 sideset_exists( const id_t aID ) const ;
617
618//------------------------------------------------------------------------------
619
623 bool
624 node_exists( const id_t aID ) const ;
625
626//------------------------------------------------------------------------------
627
632 thin_shells();
633
634//------------------------------------------------------------------------------
635
640 elements();
641
642//------------------------------------------------------------------------------
643
648 facets();
649
650//------------------------------------------------------------------------------
651
657
658//------------------------------------------------------------------------------
659
664 sidesets();
665
666//------------------------------------------------------------------------------
667
672 curves();
673
674//------------------------------------------------------------------------------
675
680 curve( const id_t aID );
681
682//------------------------------------------------------------------------------
683
684 void
686
687//------------------------------------------------------------------------------
688
693 edges();
694
695//------------------------------------------------------------------------------
696
701 faces();
702
703//------------------------------------------------------------------------------
704
709 vertices();
710
711 //------------------------------------------------------------------------------
712
718
719//------------------------------------------------------------------------------
720
724 void
725 partition(
726 const uint & aNumberOfPartitions,
727 const bool aSetProcOwners = true,
728 const bool aForceContinuousPartitions = true,
729 const bool aResetVertexContainers = true );
730
731//------------------------------------------------------------------------------
732
736 void
737 partition( const uint & aNumberOfPartitions,
738 const Vector< id_t > & aSelectedBlocks,
739 const bool aSetProcOwners = true,
740 const bool aForceContinuousPartitions = false,
741 const bool aResetVertexContainers = true );
742
743//------------------------------------------------------------------------------
744
748 void
749 partition( const uint & aNumberOfPartitions,
750 const Vector< id_t > & aSelectedBlocks,
751 const Vector< id_t > & aSelectedSideSets,
752 const bool aSetProcOwners = true,
753 const bool aForceContinuousPartitions = false,
754 const bool aResetVertexContainers = true );
755
756
757//------------------------------------------------------------------------------
758
759 void
761
762//------------------------------------------------------------------------------
763
764 void
766
767//------------------------------------------------------------------------------
768
769 void
771
772//------------------------------------------------------------------------------
773
774 void
776
777//------------------------------------------------------------------------------
778
787 void
788 create_edges( const bool aPrint=false,
789 const Vector< id_t > aNedelecBlocks = Vector< id_t >(),
790 const Vector< id_t > aNedelecSideSets = Vector< id_t >(),
791 const bool aCreateEdgesOnAllSideSets = true );
792
793//------------------------------------------------------------------------------
794
795 void
796 reset_edges();
797
798//------------------------------------------------------------------------------
799
806 void
807 create_faces( const bool aPrint=false,
808 const Vector< id_t > aNedelecBlocks = Vector< id_t >(),
809 const Vector< id_t > aNedelecSideSets = Vector< id_t >() );
810
811 void
812 reset_faces();
813
814//------------------------------------------------------------------------------
815
816 void
818
819//------------------------------------------------------------------------------
820
821 void
823
824//------------------------------------------------------------------------------
825
826 void
828
829//------------------------------------------------------------------------------
830
834 real &
835 time_stamp();
836
837//------------------------------------------------------------------------------
838
842 const uint &
843 time_step() const;
844
845 uint &
846 time_step() ;
847
848//------------------------------------------------------------------------------
849
853 void
854 set_time_step( const uint aTimeStep );
855
856
857//------------------------------------------------------------------------------
858
859 void
860 set_connectivity( const Connectivity aConnectivity ) ;
861
862//------------------------------------------------------------------------------
863
864 void
865 reset_connectivity( const Connectivity aConnectivity ) ;
866
867//------------------------------------------------------------------------------
868
869 bool
870 test_connectivity( const Connectivity aConnectivity );
871
872//------------------------------------------------------------------------------
873
877 const proc_t &
878 master() const;
879
880//------------------------------------------------------------------------------
881
882 void
884
885//------------------------------------------------------------------------------
886
887 void
889
890//------------------------------------------------------------------------------
891
895 void
896 set_number_of_partitions( const proc_t & aNumberOfPartitions );
897
898//------------------------------------------------------------------------------
899
904 bool
905 edges_exist() const ;
906
907//------------------------------------------------------------------------------
908
912 bool
913 faces_exist() const ;
914
915//------------------------------------------------------------------------------
916
920 void
922
923//------------------------------------------------------------------------------
924
928 void
930
931//------------------------------------------------------------------------------
932
936 const uint &
937 max_element_order() const ;
938
939//------------------------------------------------------------------------------
940
944 void
946
947//------------------------------------------------------------------------------
948
949 bool
950 is_kernel_mesh() const ;
951
952//------------------------------------------------------------------------------
953
957 void
959
960//------------------------------------------------------------------------------
961
962 void
964
965//------------------------------------------------------------------------------
966
967 void
968 save_faces( const string & aPath );
969
970//------------------------------------------------------------------------------
971
972 id_t
973 max_node_id() ;
974
975//------------------------------------------------------------------------------
976
977 id_t
979
980//------------------------------------------------------------------------------
981
982 id_t
984
985//------------------------------------------------------------------------------
986
987 void
989
990//------------------------------------------------------------------------------
991
993 autopins();
994
995//------------------------------------------------------------------------------
996
999
1000//------------------------------------------------------------------------------
1001
1004
1005//------------------------------------------------------------------------------
1006
1007 // compute and return the checksum
1008 std::size_t
1009 checksum() ;
1010
1011//------------------------------------------------------------------------------
1012
1013 // enforces a checksum instead of computing it; used by BfmFile::load()
1014 // and by the controller to stamp a derived mesh
1015 void
1016 force_checksum( const std::size_t aChecksum ) ;
1017
1018//------------------------------------------------------------------------------
1019
1020 // the settings fingerprint that travels into the mesh file, see mConfigTag
1021 void
1022 set_config_tag( const uint64_t aTag, const string & aText ) ;
1023
1024 uint64_t
1025 config_tag() const ;
1026
1027 const string &
1028 config_text() const ;
1029
1030//------------------------------------------------------------------------------
1031
1032 void
1034
1035 void
1037
1038 void
1040
1041 id_t
1042 max_node_id() const ;
1043
1044 id_t
1045 max_element_id() const ;
1046
1047
1048 Mesh *
1050
1051 void
1053
1054 void
1055 set_compute_facet_orientation_flag( const bool aFlag );
1056
1057//------------------------------------------------------------------------------
1058
1062 size_t
1063 memory() const ;
1064
1065//------------------------------------------------------------------------------
1066
1067 bool
1068 has_periodicity() const;
1069
1071 periodicity();
1072
1073 void
1074 set_periodicity( mesh::Periodicity * aPeriodicity );
1075
1076 //void
1077 //save_fields( const string & aFilename, const uint aRunningTimestep=0 );
1078
1079 //uint
1080 //load_fields( const string & aFilename );
1081
1082 void
1083 save_meta( hid_t aFile, const uint aRunningTimestep=0 );
1084
1085 uint
1086 load_meta( hid_t aFile );
1087
1088 void
1089 save_fields( hid_t aFile );
1090
1091 void
1092 load_fields( hid_t aFile );
1093
1094 void
1095 save_globals( hid_t aFile );
1096
1097 void
1098 load_globals( hid_t aFile );
1099
1100 void
1102
1103 void
1105
1106 bool
1107 mesh_checker_flag() const;
1108
1109//------------------------------------------------------------------------------
1110 private:
1111//------------------------------------------------------------------------------
1112
1113 // Resize every existing field whose entity type matches aEntityType
1114 // to aSize and reset its values to 0.0. Called from finalize() for
1115 // NODE and ELEMENT, finalize_edges() for EDGE, and finalize_faces()
1116 // for FACE so that fields registered before mesh-topology updates
1117 // (cut duplication, partitioning, etc.) stay in sync with the
1118 // current entity counts.
1119 void
1120 resize_and_reset_fields( const EntityType aEntityType, const index_t aSize );
1121
1122//------------------------------------------------------------------------------
1123
1124 void
1125 create_maps();
1126
1127//------------------------------------------------------------------------------
1128
1129 void
1130 reset_maps();
1131
1132//------------------------------------------------------------------------------
1133
1134 // set the block ids of each element
1135 void
1136 set_block_ids();
1137
1138//------------------------------------------------------------------------------
1139
1140 // set the sideset ids of each facet
1141 void
1142 set_sideset_ids();
1143
1144
1145
1146//------------------------------------------------------------------------------
1147
1148 // set the indices for the sidesets (needed to create curves)
1149 void
1150 set_sideset_indices();
1151
1152//------------------------------------------------------------------------------
1153
1154 // set the indices for the blocks
1155 void
1156 set_block_indices();
1157
1158//------------------------------------------------------------------------------
1159
1163 void
1164 compute_max_element_order();
1165
1166//------------------------------------------------------------------------------
1167
1168 void
1169 compute_edge_directions();
1170
1171//------------------------------------------------------------------------------
1172
1173 void
1174 compute_checksum();
1175
1176//------------------------------------------------------------------------------
1177
1178 };
1179
1180//------------------------------------------------------------------------------
1181
1182 inline const string &
1184 {
1185 return mPath ;
1186 }
1187
1188//------------------------------------------------------------------------------
1189
1190 inline bool
1192 {
1193 return mTensorConfig != nullptr;
1194 }
1195
1196//------------------------------------------------------------------------------
1197
1198 inline const TensorMeshConfig *
1200 {
1201 return mTensorConfig;
1202 }
1203
1204//------------------------------------------------------------------------------
1205
1206 inline uint
1208 {
1209 return mNumberOfDimensions;
1210 }
1211
1212//------------------------------------------------------------------------------
1213
1214 inline void
1215 Mesh::set_number_of_dimensions( const uint & aNumberOfDimensions )
1216 {
1217 mNumberOfDimensions = aNumberOfDimensions;
1218 }
1219
1220//------------------------------------------------------------------------------
1221
1222 inline index_t
1224 {
1225 return mNodes.size();
1226 }
1227
1228//------------------------------------------------------------------------------
1229
1230 inline index_t
1232 {
1233 return mElements.size();
1234 }
1235
1236//------------------------------------------------------------------------------
1237
1238 inline index_t
1240 {
1241 return mFacets.size();
1242 }
1243
1244//------------------------------------------------------------------------------
1245
1246 inline index_t
1248 {
1249 return mEdges.size();
1250 }
1251
1252//------------------------------------------------------------------------------
1253
1254 inline index_t
1256 {
1257 return mFaces.size();
1258 }
1259
1260//------------------------------------------------------------------------------
1261
1262 inline index_t
1264 {
1265 return mControlPoints.size();
1266 }
1267
1268//------------------------------------------------------------------------------
1269
1270 inline uint
1272 {
1273 return mBlocks.size();
1274 }
1275
1276//------------------------------------------------------------------------------
1277
1278 inline uint
1280 {
1281 return mSideSets.size();
1282 }
1283
1284//------------------------------------------------------------------------------
1285
1286 inline mesh::Node *
1287 Mesh::node( const id_t aID )
1288 {
1290 "Tried to access invalid node id: %lu.",
1291 ( long unsigned int ) aID );
1292
1293 return mNodeMap( aID );
1294 }
1295
1296//------------------------------------------------------------------------------
1297
1298 inline mesh::Node *
1299 Mesh::node( const index_t i, const index_t j )
1300 {
1301 BELFEM_ASSERT( this->is_tensormesh() && this->number_of_dimensions() == 2,
1302 "can only access node over 2d index on 2d-tensormeshes" );
1303
1304 return mNodes( mTensorConfig->node_index( i, j ) );
1305 }
1306
1307//------------------------------------------------------------------------------
1308
1309 inline mesh::Node *
1310 Mesh::node( const index_t i, const index_t j, const index_t k )
1311 {
1312 BELFEM_ASSERT( this->is_tensormesh() && this->number_of_dimensions() == 3,
1313 "can only access node over 3d index on 3d-tensormeshes" );
1314
1315 return mNodes( mTensorConfig->node_index( i, j, k ) );
1316 }
1317//------------------------------------------------------------------------------
1318
1319 inline mesh::Edge *
1320 Mesh::edge( const id_t aID )
1321 {
1323 "Tried to access invalid edge id: %lu.",
1324 ( long unsigned int ) aID );
1325
1326 return mEdgeMap( aID );
1327 }
1328
1329//------------------------------------------------------------------------------
1330
1331 inline mesh::Face *
1332 Mesh::face( const id_t aID )
1333 {
1335 "Tried to access invalid face id: %lu.",
1336 ( long unsigned int ) aID );
1337
1338 return mFaceMap( aID );
1339 }
1340
1341//------------------------------------------------------------------------------
1342
1343 inline bool
1344 Mesh::element_exists( const id_t aID ) const
1345 {
1346 return mElementMap.key_exists( aID );
1347 }
1348
1349//------------------------------------------------------------------------------
1350
1351 inline mesh::Element *
1352 Mesh::element( const id_t aID )
1353 {
1355 "Tried to access invalid element id: %lu.",
1356 ( long unsigned int ) aID );
1357
1358 return mElementMap( aID ) ;
1359 }
1360
1361//------------------------------------------------------------------------------
1362
1363 inline mesh::Element *
1364 Mesh::element( const index_t i, const index_t j )
1365 {
1366 BELFEM_ASSERT( this->is_tensormesh() && this->number_of_dimensions() == 2,
1367 "can only access element over 2d index on 2d-tensormeshes" );
1368
1369 return mElements( mTensorConfig->element_index( i, j ) );
1370 }
1371
1372//------------------------------------------------------------------------------
1373
1374 inline mesh::Element *
1375 Mesh::element( const index_t i, const index_t j, const index_t k )
1376 {
1377 BELFEM_ASSERT( this->is_tensormesh() && this->number_of_dimensions() == 3,
1378 "can only access element over 3d index on 3d-tensormeshes" );
1379
1380 return mElements( mTensorConfig->element_index( i, j, k ) );
1381 }
1382
1383//------------------------------------------------------------------------------
1384
1385 inline mesh::ControlPoint *
1387 {
1389 "Tried to access invalid control point id: %lu.",
1390 ( long unsigned int ) aID );
1391
1392 return mControlPointMap( aID );
1393 }
1394
1395 inline mesh::ControlPoint *
1397 {
1398 BELFEM_ASSERT( this->is_tensormesh() && this->number_of_dimensions() == 2,
1399 "can only access control point over 2d index on 2d-tensormeshes" );
1400
1401 return mControlPoints(
1402 i * mTensorConfig->num_control_points( 1 ) + j );
1403 }
1404
1405 inline mesh::ControlPoint *
1406 Mesh::control_point( const index_t i, const index_t j, const index_t k )
1407 {
1408 BELFEM_ASSERT( this->is_tensormesh() && this->number_of_dimensions() == 3,
1409 "can only access control point over 3d index on 3d-tensormeshes" );
1410
1411 return mControlPoints(
1413 ( i * mTensorConfig->num_control_points( 1 ) + j ) + k );
1414 }
1415
1416
1417//------------------------------------------------------------------------------
1418
1419 inline bool
1420 Mesh::facet_exists( const id_t aID ) const
1421 {
1422 return mFacetMap.key_exists( aID );
1423 }
1424
1425//------------------------------------------------------------------------------
1426
1427 inline mesh::Facet *
1428 Mesh::facet( const id_t aID )
1429 {
1431 "Tried to access invalid facet id: %lu.",
1432 ( long unsigned int ) aID );
1433
1434 return mFacetMap( aID );
1435 }
1436
1437//------------------------------------------------------------------------------
1438
1439 inline mesh::Block *
1440 Mesh::block( const id_t aID )
1441 {
1443 "Tried to access invalid block id: %lu.",
1444 ( long unsigned int ) aID );
1445
1446 return mBlockMap( aID );
1447 }
1448
1449//------------------------------------------------------------------------------
1450
1451 inline mesh::SideSet *
1452 Mesh::sideset( const id_t aID )
1453 {
1455 "Tried to access invalid sideset id: %lu.",
1456 ( long unsigned int ) aID );
1457
1458 return mSideSetMap( aID );
1459 }
1460
1461//------------------------------------------------------------------------------
1462
1463 inline mesh::Element *
1464 Mesh::vertex( const id_t aID )
1465 {
1467 "Tried to access invalid vertex id: %lu.",
1468 ( long unsigned int ) aID );
1469
1470 return mVertexMap( aID );
1471 }
1472
1473//------------------------------------------------------------------------------
1474
1475 inline mesh::Field *
1476 Mesh::field( const index_t aIndex )
1477 {
1478 return mFields( aIndex );
1479 }
1480
1481//------------------------------------------------------------------------------
1482
1483 inline mesh::Field *
1484 Mesh::field( const string & aLabel )
1485 {
1487 "Field '%s' does not exist on mesh", aLabel.c_str());
1488
1489 return mFieldMap( aLabel );
1490 }
1491
1492//------------------------------------------------------------------------------
1493
1494 inline bool
1495 Mesh::field_exists( const string & aLabel )
1496 {
1497 return mFieldMap.key_exists( aLabel ) ;
1498 }
1499
1500
1501//------------------------------------------------------------------------------
1502
1503 inline Vector< real > &
1504 Mesh::field_data( const string & aLabel )
1505 {
1507 "Field '%s' does not exist on mesh", aLabel.c_str());
1508
1509 return mFieldMap( aLabel )->data();
1510 }
1511
1512//------------------------------------------------------------------------------
1513
1516 {
1517 return mGlobalVariables;
1518 }
1519
1520//------------------------------------------------------------------------------
1521
1522 inline mesh::GlobalVariable *
1524 {
1525 return mGlobalVariableIDMap( aID );
1526 }
1527
1528//------------------------------------------------------------------------------
1529
1530 inline mesh::GlobalVariable *
1531 Mesh::global_variable( const string & aLabel )
1532 {
1533 return mGlobalVariableMap( aLabel );
1534 }
1535
1536//------------------------------------------------------------------------------
1537
1538 inline real &
1539 Mesh::global_variable_data( const string & aLabel )
1540 {
1541 return mGlobalVariableMap( aLabel )->value();
1542 }
1543
1544//------------------------------------------------------------------------------
1545
1546 // test if a global variable has already been created
1547 inline bool
1548 Mesh::global_variable_exists( const string & aLabel )
1549 {
1550 return mGlobalVariableMap.key_exists( aLabel );
1551 }
1552
1553//------------------------------------------------------------------------------
1554
1555 inline uint
1557 {
1558 return mFields.size() ;
1559 }
1560
1561//------------------------------------------------------------------------------
1562
1563 inline uint
1565 {
1566 return mGlobalVariables.size();
1567 }
1568
1569//------------------------------------------------------------------------------
1570
1574 inline real &
1576 {
1577 return mTimeStamp;
1578 }
1579
1580//------------------------------------------------------------------------------
1581
1585 inline const uint &
1587 {
1588 return mTimeStep;
1589 }
1590
1591 inline uint &
1593 {
1594 return mTimeStep;
1595 }
1596
1597
1598//------------------------------------------------------------------------------
1599
1600 inline void
1601 Mesh::set_time_step( const uint aTimeStep )
1602 {
1603 mTimeStep = aTimeStep;
1604 }
1605
1606//------------------------------------------------------------------------------
1607
1608 inline void
1610 {
1611 mConnectivities.set( static_cast<index_t>( aConnectivity ));
1612 }
1613
1614//------------------------------------------------------------------------------
1615
1616 inline void
1618 {
1619 mConnectivities.reset( static_cast<index_t>( aConnectivity ));
1620 }
1621
1622//------------------------------------------------------------------------------
1623
1624 inline bool
1626 {
1627 return mConnectivities.test( static_cast<index_t>( aConnectivity ));
1628 }
1629
1630//------------------------------------------------------------------------------
1631
1632 inline const proc_t &
1634 {
1635 return mMasterProc;
1636 }
1637
1638//------------------------------------------------------------------------------
1639
1640 inline void
1641 Mesh::set_number_of_partitions( const proc_t & aNumberOfPartitions )
1642 {
1643 mNumberOfPartitions = aNumberOfPartitions;
1644 }
1645
1646//------------------------------------------------------------------------------
1647
1648 inline bool
1649 Mesh::block_exists( const id_t aID ) const
1650 {
1651 return mBlockMap.key_exists( aID );
1652 }
1653
1654//------------------------------------------------------------------------------
1655
1656 inline bool
1657 Mesh::sideset_exists( const id_t aID ) const
1658 {
1659 return mSideSetMap.key_exists( aID );
1660 }
1661
1662//------------------------------------------------------------------------------
1663
1664 inline bool
1665 Mesh::node_exists( const id_t aID ) const
1666 {
1667 return mNodeMap.key_exists( aID );
1668 }
1669
1670//------------------------------------------------------------------------------
1671
1672 inline bool
1674 {
1675 return mEdges.size() > 0 ;
1676 }
1677
1678//------------------------------------------------------------------------------
1679
1680 inline bool
1682 {
1683 return mFaces.size() > 0 ;
1684 }
1685
1686//------------------------------------------------------------------------------
1687
1688 inline const uint &
1690 {
1691 return mMaxElementOrder;
1692 }
1693
1694//------------------------------------------------------------------------------
1695
1696 inline Cell< mesh::Node * > &
1698 {
1699 return mNodes;
1700 }
1701
1702//------------------------------------------------------------------------------
1703
1704 inline Cell< mesh::Block * > &
1706 {
1707 return mBlocks;
1708 }
1709
1710
1711//------------------------------------------------------------------------------
1712
1715 {
1716 return mSideSets;
1717 }
1718
1719//------------------------------------------------------------------------------
1720
1721 inline Cell< mesh::Curve * > &
1723 {
1724 return mCurves;
1725 }
1726
1727//------------------------------------------------------------------------------
1728
1729 inline mesh::Curve *
1730 Mesh::curve( const id_t aID )
1731 {
1732 return mCurveMap( aID );
1733 }
1734
1735
1736//------------------------------------------------------------------------------
1737
1740 {
1741 return mThinShells;
1742 }
1743
1744//------------------------------------------------------------------------------
1745
1748 {
1749 return mElements;
1750 }
1751
1752//------------------------------------------------------------------------------
1753
1754 inline Cell< mesh::Facet * > &
1756 {
1757 return mFacets ;
1758 }
1759
1762 {
1763 return mControlPoints;
1764 }
1765
1766//------------------------------------------------------------------------------
1767
1768 inline Cell< mesh::Edge * > &
1770 {
1771 return mEdges ;
1772 }
1773
1774//------------------------------------------------------------------------------
1775
1776 inline Cell< mesh::Face * > &
1778 {
1779 return mFaces ;
1780 }
1781
1782//------------------------------------------------------------------------------
1783
1786 {
1787 return mBoundaryEdges;
1788 }
1789
1790//------------------------------------------------------------------------------
1791
1794 {
1795 return mVertices;
1796 }
1797
1798//------------------------------------------------------------------------------
1799
1800 inline void
1802 {
1803 mIsKernelMesh = true ;
1804 }
1805
1806//------------------------------------------------------------------------------
1807
1808 inline bool
1810 {
1811 return mIsKernelMesh ;
1812 }
1813
1814//------------------------------------------------------------------------------
1815
1816 inline Cell< mesh::Node * > &
1818 {
1819 return mAutoPins ;
1820 }
1821
1822//------------------------------------------------------------------------------
1823
1824 inline Cell< mesh::Node * > &
1826 {
1827 return mAbstractNodes ;
1828 }
1829
1830//------------------------------------------------------------------------------
1831
1832 inline Cell< mesh::Node * > &
1834 {
1835 return mOrphanedNodes ;
1836 }
1837
1838//------------------------------------------------------------------------------
1839
1840 inline mesh::Basis *
1841 Mesh::basis_by_index( const EntityType aType, const index_t aIndex )
1842 {
1843 switch ( aType )
1844 {
1845 case EntityType::NODE :
1846 {
1847 return mNodes( aIndex );
1848 }
1849 case EntityType::EDGE :
1850 {
1851 return mEdges( aIndex );
1852 }
1853 case EntityType::FACE :
1854 {
1855 return mFaces( aIndex );
1856 }
1857 case EntityType::ELEMENT :
1858 {
1859 return mElements( aIndex );
1860 }
1861 case EntityType::FACET :
1862 {
1863 return mFacets( aIndex );
1864 }
1866 {
1867 return mControlPoints( aIndex );
1868 }
1869 default:
1870 {
1871 BELFEM_ERROR( false, "Invalid entity type" );
1872 return nullptr;
1873 }
1874 }
1875
1876 }
1877
1878 inline mesh::Basis* Mesh::basis( const EntityType aType, const id_t aID )
1879 {
1880 switch ( aType )
1881 {
1882 case EntityType::NODE :
1883 {
1884 return this->node( aID );
1885 }
1886 case EntityType::EDGE :
1887 {
1888 return this->edge( aID );
1889 }
1890 case EntityType::FACE :
1891 {
1892 return this->face( aID );
1893 }
1894 case EntityType::ELEMENT :
1895 {
1896 return this->element( aID );
1897 }
1898 case EntityType::FACET :
1899 {
1900 return this->facet( aID );
1901 }
1903 {
1904 return this->control_point( aID );
1905 }
1906 default:
1907 {
1908 BELFEM_ERROR( false, "Invalid entity type" );
1909 return nullptr;
1910 }
1911 }
1912 }
1913
1914 inline void
1919
1920 inline bool
1922 {
1923 return mIsFinalized ;
1924 }
1925
1926 inline bool
1928 {
1929 return mEdgesAreFinalized ;
1930 }
1931
1932
1933 inline bool
1935 {
1936 return mFacesAreFinalized ;
1937 }
1938
1939
1940//------------------------------------------------------------------------------
1941
1948
1949 inline index_t
1959
1960
1961 inline void
1963 {
1964 BELFEM_ASSERT( mPeriodicity == nullptr, "Periodicity object has already been set for this mesh" );
1965 mPeriodicity = aPeriodicity;
1966 }
1967
1968 inline bool
1970 {
1971 return mPeriodicity != nullptr;
1972 }
1973
1974 inline mesh::Periodicity *
1976 {
1977 BELFEM_ASSERT( mPeriodicity != nullptr, "Periodicity object has not been set for this mesh" );
1978
1979 return mPeriodicity;
1980 }
1981
1982
1983 inline void
1985 {
1986 mMeshCheckerFlag = true;
1987 }
1988
1989 inline void
1994
1995 inline bool
1997 {
1998 return mMeshCheckerFlag;
1999 }
2000
2001
2002 namespace mesh
2003 {
2004 template< typename T >
2005 void
2006 collect_hanging_basis( Cell< T * > & aBasis, Cell< T * > & aHangingBasis )
2007 {
2008 index_t tCount = 0 ;
2009 for( T * tBasis : aBasis )
2010 {
2011 if( tBasis->is_hanging() )
2012 {
2013 ++tCount ;
2014 }
2015 }
2016
2017 if( tCount == 0 )
2018 {
2019 aHangingBasis.clear();
2020 }
2021 else
2022 {
2023 aHangingBasis.set_size( tCount, nullptr );
2024 tCount = 0;
2025 for ( T * tBasis: aBasis )
2026 {
2027 if ( tBasis->is_hanging())
2028 {
2029 aHangingBasis( tCount++ ) = tBasis;
2030 }
2031 }
2032 }
2033 }
2034
2035//------------------------------------------------------------------------------
2036
2037//------------------------------------------------------------------------------
2038 }
2039}
2040
2041#endif //BELFEM_CL_MESH_HPP
#define BELFEM_ERROR(aCheck,...)
Definition assert.hpp:264
#define BELFEM_ASSERT(aCheck,...)
Definition assert.hpp:244
void reset(const index_t aIndex)
set a bit to false
Definition cl_Bitset.hpp:103
void set(const index_t aIndex)
set a bit to true
Definition cl_Bitset.hpp:92
bool test(const index_t aIndex) const
test if a bit is set
Definition cl_Bitset.hpp:138
Bitset()=default
trivial constructor
Cell is a wrapper around the standard vector.
Definition cl_Cell.hpp:42
void set_size(const size_t aSize)
Definition cl_Cell.hpp:189
size_t size() const
return the size of the Cell
Definition cl_Cell.hpp:181
void clear()
clear the memory
Definition cl_Cell.hpp:240
Incremental hash computation.
Definition cl_Hash.hpp:29
Hash map (unordered key-value).
Definition cl_Map.hpp:75
bool key_exists(const Key &aKey) const
Definition cl_Map.hpp:161
Top-level container for all mesh entities.
Definition cl_Mesh.hpp:60
Cell< mesh::Element * > mHangingElements
Definition cl_Mesh.hpp:99
Cell< mesh::ControlPoint * > & control_points()
expose Control Point container
Definition cl_Mesh.hpp:1761
Cell< mesh::Edge * > mHangingEdges
Definition cl_Mesh.hpp:96
mesh::Field * field(const string &aLabel)
get field by label
Definition cl_Mesh.hpp:1484
void update_facet_indices()
Definition cl_Mesh.cpp:463
const proc_t mCommSize
Definition cl_Mesh.hpp:68
bool mEdgesAreFinalized
Definition cl_Mesh.hpp:148
Cell< mesh::Element * > & vertices()
expose Vertex container
Definition cl_Mesh.hpp:1793
void set_kernel_flag()
called by kernel
Definition cl_Mesh.hpp:1801
void set_periodicity(mesh::Periodicity *aPeriodicity)
Definition cl_Mesh.hpp:1962
bool mesh_checker_flag() const
Definition cl_Mesh.hpp:1996
Cell< mesh::Curve * > & curves()
expose Curve container
Definition cl_Mesh.hpp:1722
void update_sideset_map()
Definition cl_Mesh.cpp:2482
void unflag_all_nodes(const uint aFlagIndex=0)
Definition cl_Mesh.cpp:1081
Map< id_t, mesh::Element * > mElementMap
Definition cl_Mesh.hpp:130
Cell< mesh::Facet * > mFacets
Definition cl_Mesh.hpp:87
void add_sideset(mesh::SideSet *aSideSet)
Definition cl_Mesh.cpp:2293
Cell< mesh::Node * > & hanging_nodes()
Definition cl_Mesh.hpp:1942
index_t number_of_faces() const
Definition cl_Mesh.hpp:1255
void set_vertex_owners()
Definition cl_Mesh.cpp:1727
Map< id_t, mesh::GlobalVariable * > mGlobalVariableIDMap
Definition cl_Mesh.hpp:111
Cell< mesh::ControlPoint * > mHangingControlPoints
Definition cl_Mesh.hpp:100
Map< id_t, mesh::ControlPoint * > mControlPointMap
Definition cl_Mesh.hpp:137
void create_edge_map()
special function called by Kernel
Definition cl_Mesh.cpp:1610
mesh::Edge * edge(const id_t aID)
Definition cl_Mesh.hpp:1320
void update_element_indices()
Definition cl_Mesh.cpp:476
void update_element_map()
Definition cl_Mesh.cpp:2459
const uint & time_step() const
return the index of the time
Definition cl_Mesh.hpp:1586
bool facet_exists(const id_t aID) const
Definition cl_Mesh.hpp:1420
proc_t mNumberOfPartitions
Definition cl_Mesh.hpp:115
Cell< mesh::Node * > & autopins()
Definition cl_Mesh.hpp:1817
void create_curve_map()
Definition cl_Mesh.cpp:2822
index_t number_of_facets() const
Definition cl_Mesh.hpp:1239
void unflag_all_control_points(const uint aFlagIndex=0)
Definition cl_Mesh.cpp:1232
Cell< mesh::Block * > mBlocks
Definition cl_Mesh.hpp:102
Cell< mesh::Face * > & faces()
expose face container
Definition cl_Mesh.hpp:1777
Cell< mesh::Element * > mVertices
Definition cl_Mesh.hpp:88
Cell< mesh::Element * > mBoundaryEdges
Definition cl_Mesh.hpp:93
index_t number_of_elements() const
Definition cl_Mesh.hpp:1231
void compute_facet_orientations()
Definition cl_Mesh.cpp:762
bool node_exists(const id_t aID) const
check if node exists
Definition cl_Mesh.hpp:1665
uint load_meta(hid_t aFile)
Definition cl_Mesh.cpp:3052
void populate_element_neighbors()
Definition cl_Mesh.cpp:2672
Map< id_t, mesh::Node * > mNodeMap
Definition cl_Mesh.hpp:129
void finalize_faces()
Definition cl_Mesh.cpp:1022
void update_block_map()
Definition cl_Mesh.cpp:2472
void unflag_all_faces(const uint aFlagIndex=0)
Definition cl_Mesh.cpp:1139
void update_facet_nodes()
Definition cl_Mesh.cpp:674
Cell< mesh::Facet * > mHangingFacets
Definition cl_Mesh.hpp:98
bool global_variable_exists(const string &aLabel)
Definition cl_Mesh.hpp:1548
uint mNumberOfGlobalVariables
Definition cl_Mesh.hpp:118
void save_meta(hid_t aFile, const uint aRunningTimestep=0)
Definition cl_Mesh.cpp:3035
void save_globals(hid_t aFile)
Definition cl_Mesh.cpp:3109
bool mMeshCheckerFlag
Definition cl_Mesh.hpp:172
void distribute_edge_directions()
Definition cl_Mesh.cpp:1875
void set_time_step(const uint aTimeStep)
set the index of the time step
Definition cl_Mesh.hpp:1601
void collect_facets_from_sidesets()
Definition cl_Mesh.cpp:640
Cell< mesh::SideSet * > & sidesets()
expose Sideset container
Definition cl_Mesh.hpp:1714
uint number_of_fields() const
Definition cl_Mesh.hpp:1556
const string & path() const
Definition cl_Mesh.hpp:1183
Vector< real > & field_data(const string &aLabel)
Definition cl_Mesh.hpp:1504
Map< id_t, mesh::Block * > mBlockMap
Definition cl_Mesh.hpp:132
uint64_t config_tag() const
Definition cl_Mesh.cpp:2401
const proc_t mMasterProc
Definition cl_Mesh.hpp:66
uint number_of_sidesets() const
Definition cl_Mesh.hpp:1279
Cell< mesh::Facet * > & facets()
expose Facet container
Definition cl_Mesh.hpp:1755
id_t max_block_and_sideset_id()
Definition cl_Mesh.cpp:2247
uint number_of_dimensions() const
Definition cl_Mesh.hpp:1207
Cell< mesh::Node * > mAbstractNodes
for special purpose
Definition cl_Mesh.hpp:161
void save(const string &aFilePath)
Definition cl_Mesh.cpp:340
void update_node_indices()
Definition cl_Mesh.cpp:427
void unflag_all_elements(const uint aFlagIndex=0)
Definition cl_Mesh.cpp:1195
void update_face_indices()
Definition cl_Mesh.cpp:451
index_t number_of_edges() const
Definition cl_Mesh.hpp:1247
bool block_exists(const id_t aID) const
check if block exists
Definition cl_Mesh.hpp:1649
Cell< mesh::ThinShell * > & thin_shells()
expose the thinshell container
Definition cl_Mesh.hpp:1739
id_t max_element_id()
Definition cl_Mesh.cpp:2192
void set_compute_facet_orientation_flag(const bool aFlag)
Definition cl_Mesh.hpp:1915
void load_globals(hid_t aFile)
Definition cl_Mesh.cpp:3133
void collect_elements_from_blocks()
Definition cl_Mesh.cpp:602
void reset_connectivity(const Connectivity aConnectivity)
Definition cl_Mesh.hpp:1617
bool mIsKernelMesh
flag telling if this is a mesh on the kernel
Definition cl_Mesh.hpp:144
bool edges_exist() const
tells if Nedelec edges exist on this mesh
Definition cl_Mesh.hpp:1673
Cell< mesh::Node * > mOrphanedNodes
for special purpose
Definition cl_Mesh.hpp:164
const TensorMeshConfig * mTensorConfig
Definition cl_Mesh.hpp:168
void update_edge_indices()
Definition cl_Mesh.cpp:439
real & create_global_variable(const string &aLabel, const real aValue=0.0, const id_t aID=0)
Definition cl_Mesh.cpp:559
mesh::Periodicity * mPeriodicity
Definition cl_Mesh.hpp:170
mesh::Block * block(const id_t aID)
Definition cl_Mesh.hpp:1440
string mPath
Definition cl_Mesh.hpp:83
void update_vertex_indices()
Definition cl_Mesh.cpp:488
Bitset< static_cast< size_t >(Connectivity::UNDEFINED)> mConnectivities
Definition cl_Mesh.hpp:166
void set_number_of_partitions(const proc_t &aNumberOfPartitions)
to be called by partitioner
Definition cl_Mesh.hpp:1641
uint mNumberOfFields
Definition cl_Mesh.hpp:119
mesh::Curve * curve(const id_t aID)
return a curve by its ID
Definition cl_Mesh.hpp:1730
bool mNodesAreSorted
Definition cl_Mesh.hpp:152
Cell< mesh::Block * > & blocks()
expose Block container
Definition cl_Mesh.hpp:1705
Vector< real > & create_field(const string &aLabel, const EntityType aEntity=EntityType::NODE, const id_t aID=0)
Definition cl_Mesh.cpp:511
mesh::Basis * basis_by_index(const EntityType aType, const index_t aIndex)
Definition cl_Mesh.hpp:1841
bool has_periodicity() const
Definition cl_Mesh.hpp:1969
bool edges_are_finalized() const
Definition cl_Mesh.hpp:1927
void reset_faces()
Definition cl_Mesh.cpp:1454
mesh::SideSet * sideset(const id_t aID)
Definition cl_Mesh.hpp:1452
Map< id_t, mesh::Edge * > mEdgeMap
Definition cl_Mesh.hpp:135
bool mFacesAreFinalized
Definition cl_Mesh.hpp:149
real mTimeStamp
Definition cl_Mesh.hpp:121
mesh::Node * node(const id_t aID)
Definition cl_Mesh.hpp:1287
bool is_kernel_mesh() const
Definition cl_Mesh.hpp:1809
Cell< mesh::Node * > & nodes()
expose Node container
Definition cl_Mesh.hpp:1697
bool is_finalized() const
Definition cl_Mesh.hpp:1921
Cell< mesh::Element * > & hanging_elements()
Definition cl_Mesh.hpp:1946
mesh::Element * vertex(const id_t aID)
Definition cl_Mesh.hpp:1464
void create_face_map()
special function called by Kernel
Definition cl_Mesh.cpp:1626
mesh::GlobalVariable * global_variable(const id_t aID)
Definition cl_Mesh.hpp:1523
real & time_stamp()
return the current timestamp
Definition cl_Mesh.hpp:1575
void collect_elements_from_group(Cell< mesh::Element * > &aElements, const id_t aGroupId, const ElementType aType=ElementType::EMPTY)
Definition cl_Mesh.cpp:707
Map< string, mesh::GlobalVariable * > mGlobalVariableMap
Definition cl_Mesh.hpp:110
std::size_t checksum()
Definition cl_Mesh.cpp:2372
void unfinalize()
unfinalizes all aspects of mesh but edges
Definition cl_Mesh.cpp:874
void save_fields(hid_t aFile)
Definition cl_Mesh.cpp:3091
void create_faces(const bool aPrint=false, const Vector< id_t > aNedelecBlocks=Vector< id_t >(), const Vector< id_t > aNedelecSideSets=Vector< id_t >())
creates the faces on the mesh
Definition cl_Mesh.cpp:1510
void expand_hanging_basis_sources()
Definition cl_Mesh.cpp:2140
void unflag_all_edges(const uint aFlagIndex=0)
Definition cl_Mesh.cpp:1108
bool faces_exist() const
tells if Nedelec faces exist on this mesh
Definition cl_Mesh.hpp:1681
bool faces_are_finalized() const
Definition cl_Mesh.hpp:1934
mesh::Periodicity * periodicity()
Definition cl_Mesh.hpp:1975
uint number_of_blocks() const
Definition cl_Mesh.hpp:1271
void set_number_of_dimensions(const uint &aNumberOfDimensions)
Definition cl_Mesh.hpp:1215
size_t memory() const
Compute the total memory used by the mesh in bytes.
Definition cl_Mesh.cpp:2834
const proc_t mCommRank
Definition cl_Mesh.hpp:67
bool sideset_exists(const id_t aID) const
check if sideset exists
Definition cl_Mesh.hpp:1657
Map< id_t, mesh::Facet * > mFacetMap
Definition cl_Mesh.hpp:131
void create_edges(const bool aPrint=false, const Vector< id_t > aNedelecBlocks=Vector< id_t >(), const Vector< id_t > aNedelecSideSets=Vector< id_t >(), const bool aCreateEdgesOnAllSideSets=true)
creates the edges on the mesh
Definition cl_Mesh.cpp:1374
uint number_of_global_variables() const
Definition cl_Mesh.hpp:1564
Cell< mesh::Face * > mFaces
Definition cl_Mesh.hpp:90
void partition(const uint &aNumberOfPartitions, const bool aSetProcOwners=true, const bool aForceContinuousPartitions=true, const bool aResetVertexContainers=true)
partition the mesh and set element and node ownerships
Definition cl_Mesh.cpp:1243
uint mNumberOfDimensions
Definition cl_Mesh.hpp:117
Cell< mesh::Field * > mFields
Definition cl_Mesh.hpp:108
Cell< mesh::Element * > & elements()
expose Element container
Definition cl_Mesh.hpp:1747
string mConfigText
Definition cl_Mesh.hpp:81
void unflag_all_facets(const uint aFlagIndex=0)
Definition cl_Mesh.cpp:1169
mesh::Facet * facet(const id_t aID)
Definition cl_Mesh.hpp:1428
const TensorMeshConfig * tensorconf() const
Definition cl_Mesh.hpp:1199
void save_faces(const string &aPath)
Definition cl_Mesh.cpp:1963
Cell< mesh::GlobalVariable * > & global_variables()
Definition cl_Mesh.hpp:1515
Map< id_t, mesh::Element * > mVertexMap
Definition cl_Mesh.hpp:134
void scale_mesh(const real aFactor)
Multiply all node coordinates with a factor, e.g.
Definition cl_Mesh.cpp:295
uint mMaxElementOrder
Definition cl_Mesh.hpp:141
mesh::Element * element(const id_t aID)
Definition cl_Mesh.hpp:1352
Map< id_t, mesh::Curve * > mCurveMap
Definition cl_Mesh.hpp:138
bool field_exists(const string &aLabel)
Definition cl_Mesh.hpp:1495
Cell< mesh::SideSet * > mSideSets
Definition cl_Mesh.hpp:103
void reset_mesh_checker_flag()
Definition cl_Mesh.hpp:1990
void update_control_point_indices()
Definition cl_Mesh.cpp:500
void set_connectivity(const Connectivity aConnectivity)
Definition cl_Mesh.hpp:1609
mesh::Basis * basis(const EntityType aType, const id_t aID)
Definition cl_Mesh.hpp:1878
const proc_t & master() const
return the ID of the proc that owns this mesh
Definition cl_Mesh.hpp:1633
mesh::Face * face(const id_t aID)
Definition cl_Mesh.hpp:1332
Cell< mesh::ControlPoint * > mControlPoints
Definition cl_Mesh.hpp:91
Map< string, mesh::Field * > mFieldMap
Definition cl_Mesh.hpp:112
void reset_edges()
Definition cl_Mesh.cpp:1399
Cell< mesh::Node * > mHangingNodes
Definition cl_Mesh.hpp:95
Cell< mesh::Node * > & orphaned_nodes()
Definition cl_Mesh.hpp:1833
Cell< mesh::Curve * > mCurves
Definition cl_Mesh.hpp:104
void set_mesh_checker_flag()
Definition cl_Mesh.hpp:1984
void set_abstract_nodes(Cell< mesh::Node * > &aNodes)
Definition cl_Mesh.cpp:2313
Hash mHash
Definition cl_Mesh.hpp:73
Cell< mesh::Edge * > mEdges
Definition cl_Mesh.hpp:89
index_t number_of_control_points() const
Definition cl_Mesh.hpp:1263
Mesh(const uint aNumberOfDimensions, const proc_t aMasterProc=0, const bool aComputeConnectivities=true)
creates an empty mesh container but specifies number of dimension
Definition cl_Mesh.cpp:87
void finalize()
finalizes all aspects of the mesh; edges and faces are finalized too when connectivities are computed
Definition cl_Mesh.cpp:775
mesh::ControlPoint * control_point(const id_t aID)
Definition cl_Mesh.hpp:1386
Cell< mesh::ControlPoint * > & hanging_control_points()
Definition cl_Mesh.hpp:1947
Cell< mesh::Face * > & hanging_faces()
Definition cl_Mesh.hpp:1944
const string & config_text() const
Definition cl_Mesh.cpp:2409
Cell< mesh::GlobalVariable * > mGlobalVariables
Definition cl_Mesh.hpp:107
void flag_curved_elements()
flags elements that are curved
Definition cl_Mesh.cpp:1807
void load_fields(hid_t aFile)
Definition cl_Mesh.cpp:3208
uint64_t mConfigTag
Definition cl_Mesh.hpp:80
void finalize_edges()
Definition cl_Mesh.cpp:973
bool test_connectivity(const Connectivity aConnectivity)
Definition cl_Mesh.hpp:1625
Cell< mesh::Node * > & abstract_nodes()
Definition cl_Mesh.hpp:1825
void collect_hanging_basis()
Definition cl_Mesh.cpp:2128
Cell< mesh::Node * > mNodes
Definition cl_Mesh.hpp:86
real & global_variable_data(const string &aLabel)
Definition cl_Mesh.hpp:1539
id_t max_node_id()
Definition cl_Mesh.cpp:2176
Cell< mesh::Node * > mAutoPins
for special purpose
Definition cl_Mesh.hpp:158
void update_ownerships()
Definition cl_Mesh.cpp:1657
Cell< mesh::ThinShell * > mThinShells
Definition cl_Mesh.hpp:105
Map< id_t, mesh::SideSet * > mSideSetMap
Definition cl_Mesh.hpp:133
const uint & max_element_order() const
return the max interpolation order on the mesh
Definition cl_Mesh.hpp:1689
uint mTimeStep
Definition cl_Mesh.hpp:122
void unflag_everything(const uint aFlagIndex=0)
Definition cl_Mesh.cpp:1066
bool element_exists(const id_t aID) const
Definition cl_Mesh.hpp:1344
Cell< mesh::Face * > mHangingFaces
Definition cl_Mesh.hpp:97
void unflag_all_vertices(const uint aFlagIndex=0)
Definition cl_Mesh.cpp:1221
bool is_tensormesh() const
Definition cl_Mesh.hpp:1191
bool mComputeFacetOrientationsWhenFinalizing
Definition cl_Mesh.hpp:155
index_t number_of_hanging_basis() const
Definition cl_Mesh.hpp:1950
Cell< mesh::Edge * > & hanging_edges()
Definition cl_Mesh.hpp:1943
Cell< mesh::Element * > & boundary_edges()
expose container for boundary edges
Definition cl_Mesh.hpp:1785
bool mIsFinalized
flag telling if mesh is finalized (master only)
Definition cl_Mesh.hpp:147
void add_block(mesh::Block *aBlock)
Definition cl_Mesh.cpp:2284
void set_config_tag(const uint64_t aTag, const string &aText)
Definition cl_Mesh.cpp:2392
Cell< mesh::Facet * > & hanging_facets()
Definition cl_Mesh.hpp:1945
Map< id_t, mesh::Face * > mFaceMap
Definition cl_Mesh.hpp:136
index_t number_of_nodes() const
Definition cl_Mesh.hpp:1223
Cell< mesh::Element * > mElements
Definition cl_Mesh.hpp:85
Cell< mesh::Edge * > & edges()
expose edge container
Definition cl_Mesh.hpp:1769
void force_checksum(const std::size_t aChecksum)
Definition cl_Mesh.cpp:2384
Mesh * extract_thin_shell_mesh()
Definition cl_Mesh.cpp:2571
Definition cl_TensorMeshConfig.hpp:22
uint num_control_points(const uint aDimension=BELFEM_UINT_MAX) const
Definition cl_TensorMeshConfig.hpp:124
index_t node_index(const index_t i, const index_t j) const
Definition cl_TensorMeshConfig.hpp:155
index_t element_index(const index_t i, const index_t j) const
Definition cl_TensorMeshConfig.hpp:175
Definition cl_Mesh_Basis.hpp:33
Definition cl_Block.hpp:27
Definition cl_ControlPoint.hpp:27
Definition cl_Curve.hpp:27
Special Edge class for NEDELEC-Type elements.
Definition cl_Edge.hpp:30
Lagrange Element baseclass.
Definition cl_Element.hpp:35
Definition cl_Face.hpp:29
Definition cl_Facet.hpp:24
Definition cl_Mesh_Field.hpp:28
Definition cl_Mesh_GlobalVariable.hpp:24
Definition cl_Mesh_GmshReader.hpp:40
Creates a Periodicity object by matching nodes on two periodic boundary planes.
Definition cl_Mesh_PeriodicityFactory.hpp:34
Stores matched periodic boundary entity pairs (nodes, edges, faces).
Definition cl_Mesh_Periodicity.hpp:39
Definition cl_ProtoMesh.hpp:39
Definition cl_SideSet.hpp:29
Definition cl_EF_EdgeFunction.hpp:17
void collect_hanging_basis(Cell< T * > &aBasis, Cell< T * > &aHangingBasis)
Definition cl_Mesh.hpp:2006
uint compute_facet_index(Facet *aFacet, Element *aElement, Cell< Node * > &aNodes)
Definition cl_Mesh.cpp:46
USER GUIDES:
Definition cl_Capacitor.cpp:16
int hid_t
Definition hdf5_types.hpp:20
unsigned int uint
Definition typedefs.hpp:30
unsigned int id_t
Definition typedefs.hpp:41
Connectivity
Definition Mesh_Enums.hpp:145
@ UNDEFINED
Definition Mesh_Enums.hpp:182
int proc_t
Definition commtypes.hpp:29
ElementType
Element types.
Definition Mesh_Enums.hpp:27
@ EMPTY
Definition Mesh_Enums.hpp:28
EntityType
Definition Mesh_Enums.hpp:116
@ NODE
Definition Mesh_Enums.hpp:117
@ FACE
Definition Mesh_Enums.hpp:119
@ CONTROLPOINT
Definition Mesh_Enums.hpp:123
@ EDGE
Definition Mesh_Enums.hpp:118
@ FACET
Definition Mesh_Enums.hpp:121
@ ELEMENT
Definition Mesh_Enums.hpp:122
uint32_t index_t
Definition typedefs.hpp:52
double real
Definition typedefs.hpp:36
Definition Element.py:1
Definition GmshReader.py:1
Definition Node.py:1
Definition __init__.py:1