BELFEM 0.9.4
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
96
103
108
111
115
116 // how many partitions is this mesh split into?
118
122
124 uint mTimeStep = 1; // << -- timestep is 1-based for exodus compatibility
125
126
127 friend class mesh::GmshReader;
129 friend class mesh::ProtoMesh;
130
141
142 // maximum element order
144
146 bool mIsKernelMesh = false ;
147
149 bool mIsFinalized = false ;
150 bool mEdgesAreFinalized = false ;
151 bool mFacesAreFinalized = false ;
152
153 // we only call the symrcm once per mesh
154 bool mNodesAreSorted = false ;
155
156 // compute orientations on finalize
158
167
169
170 const TensorMeshConfig * mTensorConfig = nullptr ;
171
173
174 bool mMeshCheckerFlag = false ;
175
176//------------------------------------------------------------------------------
177 public:
178//------------------------------------------------------------------------------
179
183 Mesh( const uint aNumberOfDimensions, const proc_t aMasterProc=0, const bool aComputeConnectivities = true );
184
185//------------------------------------------------------------------------------
186
193 Mesh( const string & aPath,
194 const proc_t aMasterProc = 0,
195 const bool aComputeConnectivities = true,
196 const bool aParallelMode = true );
197
198//------------------------------------------------------------------------------
199
206 Mesh( const uint aOrder,
207 const Vector< index_t > aNumNodes,
208 const Vector< real > aStep,
209 const Vector< real > aOrigin = {},
210 const proc_t aMasterProc = 0,
211 const bool aComputeConnectivities = true );
212
213//------------------------------------------------------------------------------
214
220 void
221 scale_mesh( const real aFactor );
222
223//------------------------------------------------------------------------------
224
225 ~Mesh();
226
227//------------------------------------------------------------------------------
228
229 const string &
230 path() const ;
231
232//------------------------------------------------------------------------------
233
234 bool
235 is_tensormesh() const ;
236
237//------------------------------------------------------------------------------
238
239 const TensorMeshConfig *
240 tensorconf() const;
241
242//------------------------------------------------------------------------------
243
245 void
246 save( const string & aFilePath );
247
248//------------------------------------------------------------------------------
249
250 uint
251 number_of_dimensions() const;
252
253//------------------------------------------------------------------------------
254
255 void
256 set_number_of_dimensions( const uint & aNumberOfDimensions );
257
258//------------------------------------------------------------------------------
259
260 index_t
261 number_of_nodes() const;
262
263//------------------------------------------------------------------------------
264
265 index_t
266 number_of_elements() const;
267
268//------------------------------------------------------------------------------
269
270 index_t
271 number_of_facets() const;
272
273//------------------------------------------------------------------------------
274
275 index_t
276 number_of_edges() const;
277
278//------------------------------------------------------------------------------
279
280 index_t
281 number_of_faces() const;
282
283//------------------------------------------------------------------------------
284
285 index_t
287
288//------------------------------------------------------------------------------
289
290 uint
291 number_of_blocks() const;
292
293//------------------------------------------------------------------------------
294
295 uint
296 number_of_fields() const;
297
298//------------------------------------------------------------------------------
299
300 uint
302
303//------------------------------------------------------------------------------
304
305 mesh::Node *
306 node( const id_t aID );
307
308//------------------------------------------------------------------------------
309
310 mesh::Node *
311 node( const index_t i, const index_t j );
312
313//------------------------------------------------------------------------------
314
315 mesh::Node *
316 node( const index_t i, const index_t j, const index_t k );
317
318//------------------------------------------------------------------------------
319
320 mesh::Edge *
321 edge( const id_t aID );
322
323//------------------------------------------------------------------------------
324
325 mesh::Face *
326 face( const id_t aID );
327
328//------------------------------------------------------------------------------
329
330 bool
331 element_exists( const id_t aID ) const;
332
334 element( const id_t aID );
335
337 element( const index_t i, const index_t j );
338
340 element( const index_t i, const index_t j, const index_t k );
341
342//------------------------------------------------------------------------------
343
345 control_point( const id_t aID );
346
348 control_point( const index_t i, const index_t j );
349
351 control_point( const index_t i, const index_t j, const index_t k );
352
353//------------------------------------------------------------------------------
354
355 bool
356 facet_exists( const id_t aID ) const;
357
359 facet( const id_t aID );
360
361//------------------------------------------------------------------------------
362
364 block( const id_t aID );
365
366//------------------------------------------------------------------------------
367
369 sideset( const id_t aID );
370
371//------------------------------------------------------------------------------
372
374 vertex( const id_t aID );
375
376//------------------------------------------------------------------------------
377
379 basis_by_index( const EntityType aType, const index_t aIndex );
380
382 basis( const EntityType aType, const id_t aID );
383
384//------------------------------------------------------------------------------
385
390 field( const string & aLabel );
391
392//------------------------------------------------------------------------------
393
395 field( const index_t aIndex );
396
397//------------------------------------------------------------------------------
398
399 // test if a field has already been created
400 bool
401 field_exists( const string & aLabel );
402
403//------------------------------------------------------------------------------
404
406 field_data( const string & aLabel );
407
408//------------------------------------------------------------------------------
409
412
413//------------------------------------------------------------------------------
414
416 global_variable( const id_t aID );
417
418//------------------------------------------------------------------------------
419
421 global_variable( const string & aLabel );
422
423//------------------------------------------------------------------------------
424
425 real &
426 global_variable_data( const string & aLabel );
427
428//------------------------------------------------------------------------------
429
430 // test if a global variable has already been created
431 bool
432 global_variable_exists( const string & aLabel );
433
434//------------------------------------------------------------------------------
435
436 uint
437 number_of_sidesets() const;
438
439//------------------------------------------------------------------------------
440
449
450 index_t
452
453//------------------------------------------------------------------------------
454
457 void
458 add_block( mesh::Block * aBlock );
459
460//------------------------------------------------------------------------------
461
464 void
465 add_sideset( mesh::SideSet * aSideSet );
466
467//------------------------------------------------------------------------------
468
471 const string & aLabel,
472 const EntityType aEntity=EntityType::NODE,
473 const id_t aID = 0 );
474
475//------------------------------------------------------------------------------
476
477 real &
478 create_global_variable( const string & aLabel,
479 const real aValue = 0.0,
480 const id_t aID = 0 );
481
482//------------------------------------------------------------------------------
483
484 void
486
487//------------------------------------------------------------------------------
488
489 void
491
492//------------------------------------------------------------------------------
493
494 void
496
497//------------------------------------------------------------------------------
498
499 void
501 Cell< mesh::Element * > & aElements,
502 const id_t aGroupId,
503 const ElementType aType = ElementType::EMPTY );
504
505//------------------------------------------------------------------------------
506
507 void
509
510//------------------------------------------------------------------------------
511
516 void
517 finalize();
518
519//------------------------------------------------------------------------------
520
521 bool
522 is_finalized() const ;
523
524 bool
525 edges_are_finalized() const ;
526
527 bool
528 faces_are_finalized() const ;
529
530//------------------------------------------------------------------------------
531
532 void
534
535//------------------------------------------------------------------------------
536
537 void
539
540//------------------------------------------------------------------------------
541
545 void
546 unfinalize();
547
548//------------------------------------------------------------------------------
549
550 void
552
553//------------------------------------------------------------------------------
554
555 void
557
558//------------------------------------------------------------------------------
559
560 void
562
563//------------------------------------------------------------------------------
564
565 void
566 unflag_everything( const uint aFlagIndex=0 );
567
568//------------------------------------------------------------------------------
569
570 void
571 unflag_all_nodes( const uint aFlagIndex=0 );
572
573//------------------------------------------------------------------------------
574
575 void
576 unflag_all_edges( const uint aFlagIndex=0 );
577
578//------------------------------------------------------------------------------
579
580 void
581 unflag_all_faces( const uint aFlagIndex=0 );
582
583//------------------------------------------------------------------------------
584
585 void
586 unflag_all_facets( const uint aFlagIndex=0 );
587
588//------------------------------------------------------------------------------
589
590 void
591 unflag_all_elements( const uint aFlagIndex=0 );
592
593//------------------------------------------------------------------------------
594
595 void
596 unflag_all_vertices( const uint aFlagIndex=0 );
597
598//------------------------------------------------------------------------------
599
600 void
601 unflag_all_control_points( const uint aFlagIndex=0 );
602
603//------------------------------------------------------------------------------
604
611 nodes();
612
613//------------------------------------------------------------------------------
614
619 blocks();
620
621//------------------------------------------------------------------------------
622
623 bool
624 block_exists( const id_t aID ) const ;
625
626//------------------------------------------------------------------------------
627
628 bool
629 sideset_exists( const id_t aID ) const ;
630
631//------------------------------------------------------------------------------
632
633 bool
634 node_exists( const id_t aID ) const ;
635
636//------------------------------------------------------------------------------
637
642 thin_shells();
643
644//------------------------------------------------------------------------------
645
651 elements();
652
653//------------------------------------------------------------------------------
654
660 facets();
661
662//------------------------------------------------------------------------------
663
669
670//------------------------------------------------------------------------------
671
676 sidesets();
677
678//------------------------------------------------------------------------------
679
684 curves();
685
686//------------------------------------------------------------------------------
687
692 curve( const id_t aID );
693
694//------------------------------------------------------------------------------
695
696 void
698
699//------------------------------------------------------------------------------
700
705 edges();
706
707//------------------------------------------------------------------------------
708
713 faces();
714
715//------------------------------------------------------------------------------
716
721 vertices();
722
723 //------------------------------------------------------------------------------
724
730
731//------------------------------------------------------------------------------
732
738 void
739 partition(
740 const uint & aNumberOfPartitions,
741 const bool aSetProcOwners = true,
742 const bool aForceContinuousPartitions = true,
743 const bool aResetVertexContainers = true );
744
745//------------------------------------------------------------------------------
746
750 void
751 partition( const uint & aNumberOfPartitions,
752 const Vector< id_t > & aSelectedBlocks,
753 const bool aSetProcOwners = true,
754 const bool aForceContinuousPartitions = false,
755 const bool aResetVertexContainers = true );
756
757//------------------------------------------------------------------------------
758
762 void
763 partition( const uint & aNumberOfPartitions,
764 const Vector< id_t > & aSelectedBlocks,
765 const Vector< id_t > & aSelectedSideSets,
766 const bool aSetProcOwners = true,
767 const bool aForceContinuousPartitions = false,
768 const bool aResetVertexContainers = true );
769
770
771//------------------------------------------------------------------------------
772
773 void
775
776//------------------------------------------------------------------------------
777
778 void
780
781//------------------------------------------------------------------------------
782
783 void
785
786//------------------------------------------------------------------------------
787
788 void
790
791//------------------------------------------------------------------------------
792
801 void
802 create_edges( const bool aPrint=false,
803 const Vector< id_t > aNedelecBlocks = Vector< id_t >(),
804 const Vector< id_t > aNedelecSideSets = Vector< id_t >(),
805 const bool aCreateEdgesOnAllSideSets = true );
806
807//------------------------------------------------------------------------------
808
809 void
810 reset_edges();
811
812//------------------------------------------------------------------------------
813
820 void
821 create_faces( const bool aPrint=false,
822 const Vector< id_t > aNedelecBlocks = Vector< id_t >(),
823 const Vector< id_t > aNedelecSideSets = Vector< id_t >() );
824
825 void
826 reset_faces();
827
828//------------------------------------------------------------------------------
829
830 void
832
833//------------------------------------------------------------------------------
834
835 void
837
838//------------------------------------------------------------------------------
839
840 void
842
843//------------------------------------------------------------------------------
844
849 real &
850 time_stamp();
851
852//------------------------------------------------------------------------------
853
857 const uint &
858 time_step() const;
859
860 uint &
861 time_step() ;
862
863//------------------------------------------------------------------------------
864
868 void
869 set_time_step( const uint aTimeStep );
870
871
872//------------------------------------------------------------------------------
873
874 void
875 set_connectivity( const Connectivity aConnectivity ) ;
876
877//------------------------------------------------------------------------------
878
879 void
880 reset_connectivity( const Connectivity aConnectivity ) ;
881
882//------------------------------------------------------------------------------
883
884 bool
885 test_connectivity( const Connectivity aConnectivity );
886
887//------------------------------------------------------------------------------
888
892 const proc_t &
893 master() const;
894
895//------------------------------------------------------------------------------
896
897 void
899
900//------------------------------------------------------------------------------
901
902 void
904
905//------------------------------------------------------------------------------
906
910 void
911 set_number_of_partitions( const proc_t & aNumberOfPartitions );
912
913//------------------------------------------------------------------------------
914
919 bool
920 edges_exist() const ;
921
922//------------------------------------------------------------------------------
923
927 bool
928 faces_exist() const ;
929
930//------------------------------------------------------------------------------
931
935 void
937
938//------------------------------------------------------------------------------
939
943 void
945
946//------------------------------------------------------------------------------
947
951 const uint &
952 max_element_order() const ;
953
954//------------------------------------------------------------------------------
955
959 void
961
962//------------------------------------------------------------------------------
963
964 bool
965 is_kernel_mesh() const ;
966
967//------------------------------------------------------------------------------
968
972 void
974
975//------------------------------------------------------------------------------
976
979 void
981
982//------------------------------------------------------------------------------
983
984 void
985 save_faces( const string & aPath );
986
987//------------------------------------------------------------------------------
988
989 id_t
990 max_node_id() ;
991
992//------------------------------------------------------------------------------
993
994 id_t
996
997//------------------------------------------------------------------------------
998
999 id_t
1001
1002//------------------------------------------------------------------------------
1003
1008 void
1010
1011//------------------------------------------------------------------------------
1012
1014 autopins();
1015
1016//------------------------------------------------------------------------------
1017
1020
1021//------------------------------------------------------------------------------
1022
1025
1026//------------------------------------------------------------------------------
1027
1028 // compute and return the checksum
1029 std::size_t
1030 checksum() ;
1031
1032//------------------------------------------------------------------------------
1033
1034 // enforces a checksum instead of computing it; used by BfmFile::load()
1035 // and by the controller to stamp a derived mesh
1036 void
1037 force_checksum( const std::size_t aChecksum ) ;
1038
1039//------------------------------------------------------------------------------
1040
1041 // the settings fingerprint that travels into the mesh file, see mConfigTag
1042 void
1043 set_config_tag( const uint64_t aTag, const string & aText ) ;
1044
1045 uint64_t
1046 config_tag() const ;
1047
1048 const string &
1049 config_text() const ;
1050
1051//------------------------------------------------------------------------------
1052
1053 void
1055
1056 void
1058
1059 void
1061
1062 id_t
1063 max_node_id() const ;
1064
1065 id_t
1066 max_element_id() const ;
1067
1068
1070 Mesh *
1072
1073 void
1075
1076 void
1077 set_compute_facet_orientation_flag( const bool aFlag );
1078
1079//------------------------------------------------------------------------------
1080
1084 size_t
1085 memory() const ;
1086
1087//------------------------------------------------------------------------------
1088
1089 bool
1090 has_periodicity() const;
1091
1093 periodicity();
1094
1096 void
1097 set_periodicity( mesh::Periodicity * aPeriodicity );
1098
1099
1100
1101 void
1102 save_meta( hid_t aFile, const uint aRunningTimestep=0 );
1103
1104 uint
1105 load_meta( hid_t aFile );
1106
1107 void
1108 save_fields( hid_t aFile );
1109
1110 void
1111 load_fields( hid_t aFile );
1112
1113 void
1114 save_globals( hid_t aFile );
1115
1116 void
1117 load_globals( hid_t aFile );
1118
1119 void
1121
1122 void
1124
1125 bool
1126 mesh_checker_flag() const;
1127
1128//------------------------------------------------------------------------------
1129 private:
1130//------------------------------------------------------------------------------
1131
1132 // Resize every existing field whose entity type matches aEntityType
1133 // to aSize and reset its values to 0.0. Called from finalize() for
1134 // NODE and ELEMENT, finalize_edges() for EDGE, and finalize_faces()
1135 // for FACE so that fields registered before mesh-topology updates
1136 // (cut duplication, partitioning, etc.) stay in sync with the
1137 // current entity counts.
1138 void
1139 resize_and_reset_fields( const EntityType aEntityType, const index_t aSize );
1140
1141//------------------------------------------------------------------------------
1142
1143 void
1144 create_maps();
1145
1146//------------------------------------------------------------------------------
1147
1148 void
1149 reset_maps();
1150
1151//------------------------------------------------------------------------------
1152
1153 // set the block ids of each element
1154 void
1155 set_block_ids();
1156
1157//------------------------------------------------------------------------------
1158
1159 // set the sideset ids of each facet
1160 void
1161 set_sideset_ids();
1162
1163
1164
1165//------------------------------------------------------------------------------
1166
1167 // set the indices for the sidesets (needed to create curves)
1168 void
1169 set_sideset_indices();
1170
1171//------------------------------------------------------------------------------
1172
1173 // set the indices for the blocks
1174 void
1175 set_block_indices();
1176
1177//------------------------------------------------------------------------------
1178
1182 void
1183 compute_max_element_order();
1184
1185//------------------------------------------------------------------------------
1186
1187 void
1188 compute_edge_directions();
1189
1190//------------------------------------------------------------------------------
1191
1192 void
1193 compute_checksum();
1194
1195//------------------------------------------------------------------------------
1196
1197 };
1198
1199//------------------------------------------------------------------------------
1200
1201 inline const string &
1203 {
1204 return mPath ;
1205 }
1206
1207//------------------------------------------------------------------------------
1208
1209 inline bool
1211 {
1212 return mTensorConfig != nullptr;
1213 }
1214
1215//------------------------------------------------------------------------------
1216
1217 inline const TensorMeshConfig *
1219 {
1220 return mTensorConfig;
1221 }
1222
1223//------------------------------------------------------------------------------
1224
1225 inline uint
1227 {
1228 return mNumberOfDimensions;
1229 }
1230
1231//------------------------------------------------------------------------------
1232
1233 inline void
1234 Mesh::set_number_of_dimensions( const uint & aNumberOfDimensions )
1235 {
1236 mNumberOfDimensions = aNumberOfDimensions;
1237 }
1238
1239//------------------------------------------------------------------------------
1240
1241 inline index_t
1243 {
1244 return mNodes.size();
1245 }
1246
1247//------------------------------------------------------------------------------
1248
1249 inline index_t
1251 {
1252 return mElements.size();
1253 }
1254
1255//------------------------------------------------------------------------------
1256
1257 inline index_t
1259 {
1260 return mFacets.size();
1261 }
1262
1263//------------------------------------------------------------------------------
1264
1265 inline index_t
1267 {
1268 return mEdges.size();
1269 }
1270
1271//------------------------------------------------------------------------------
1272
1273 inline index_t
1275 {
1276 return mFaces.size();
1277 }
1278
1279//------------------------------------------------------------------------------
1280
1281 inline index_t
1283 {
1284 return mControlPoints.size();
1285 }
1286
1287//------------------------------------------------------------------------------
1288
1289 inline uint
1291 {
1292 return mBlocks.size();
1293 }
1294
1295//------------------------------------------------------------------------------
1296
1297 inline uint
1299 {
1300 return mSideSets.size();
1301 }
1302
1303//------------------------------------------------------------------------------
1304
1305 inline mesh::Node *
1306 Mesh::node( const id_t aID )
1307 {
1309 "Tried to access invalid node id: %lu.",
1310 ( long unsigned int ) aID );
1311
1312 return mNodeMap( aID );
1313 }
1314
1315//------------------------------------------------------------------------------
1316
1317 inline mesh::Node *
1318 Mesh::node( const index_t i, const index_t j )
1319 {
1320 BELFEM_ASSERT( this->is_tensormesh() && this->number_of_dimensions() == 2,
1321 "can only access node over 2d index on 2d-tensormeshes" );
1322
1323 return mNodes( mTensorConfig->node_index( i, j ) );
1324 }
1325
1326//------------------------------------------------------------------------------
1327
1328 inline mesh::Node *
1329 Mesh::node( const index_t i, const index_t j, const index_t k )
1330 {
1331 BELFEM_ASSERT( this->is_tensormesh() && this->number_of_dimensions() == 3,
1332 "can only access node over 3d index on 3d-tensormeshes" );
1333
1334 return mNodes( mTensorConfig->node_index( i, j, k ) );
1335 }
1336//------------------------------------------------------------------------------
1337
1338 inline mesh::Edge *
1339 Mesh::edge( const id_t aID )
1340 {
1342 "Tried to access invalid edge id: %lu.",
1343 ( long unsigned int ) aID );
1344
1345 return mEdgeMap( aID );
1346 }
1347
1348//------------------------------------------------------------------------------
1349
1350 inline mesh::Face *
1351 Mesh::face( const id_t aID )
1352 {
1354 "Tried to access invalid face id: %lu.",
1355 ( long unsigned int ) aID );
1356
1357 return mFaceMap( aID );
1358 }
1359
1360//------------------------------------------------------------------------------
1361
1362 inline bool
1363 Mesh::element_exists( const id_t aID ) const
1364 {
1365 return mElementMap.key_exists( aID );
1366 }
1367
1368//------------------------------------------------------------------------------
1369
1370 inline mesh::Element *
1371 Mesh::element( const id_t aID )
1372 {
1374 "Tried to access invalid element id: %lu.",
1375 ( long unsigned int ) aID );
1376
1377 return mElementMap( aID ) ;
1378 }
1379
1380//------------------------------------------------------------------------------
1381
1382 inline mesh::Element *
1383 Mesh::element( const index_t i, const index_t j )
1384 {
1385 BELFEM_ASSERT( this->is_tensormesh() && this->number_of_dimensions() == 2,
1386 "can only access element over 2d index on 2d-tensormeshes" );
1387
1388 return mElements( mTensorConfig->element_index( i, j ) );
1389 }
1390
1391//------------------------------------------------------------------------------
1392
1393 inline mesh::Element *
1394 Mesh::element( const index_t i, const index_t j, const index_t k )
1395 {
1396 BELFEM_ASSERT( this->is_tensormesh() && this->number_of_dimensions() == 3,
1397 "can only access element over 3d index on 3d-tensormeshes" );
1398
1399 return mElements( mTensorConfig->element_index( i, j, k ) );
1400 }
1401
1402//------------------------------------------------------------------------------
1403
1404 inline mesh::ControlPoint *
1406 {
1408 "Tried to access invalid control point id: %lu.",
1409 ( long unsigned int ) aID );
1410
1411 return mControlPointMap( aID );
1412 }
1413
1414 inline mesh::ControlPoint *
1416 {
1417 BELFEM_ASSERT( this->is_tensormesh() && this->number_of_dimensions() == 2,
1418 "can only access control point over 2d index on 2d-tensormeshes" );
1419
1420 return mControlPoints(
1421 i * mTensorConfig->num_control_points( 1 ) + j );
1422 }
1423
1424 inline mesh::ControlPoint *
1425 Mesh::control_point( const index_t i, const index_t j, const index_t k )
1426 {
1427 BELFEM_ASSERT( this->is_tensormesh() && this->number_of_dimensions() == 3,
1428 "can only access control point over 3d index on 3d-tensormeshes" );
1429
1430 return mControlPoints(
1432 ( i * mTensorConfig->num_control_points( 1 ) + j ) + k );
1433 }
1434
1435
1436//------------------------------------------------------------------------------
1437
1438 inline bool
1439 Mesh::facet_exists( const id_t aID ) const
1440 {
1441 return mFacetMap.key_exists( aID );
1442 }
1443
1444//------------------------------------------------------------------------------
1445
1446 inline mesh::Facet *
1447 Mesh::facet( const id_t aID )
1448 {
1450 "Tried to access invalid facet id: %lu.",
1451 ( long unsigned int ) aID );
1452
1453 return mFacetMap( aID );
1454 }
1455
1456//------------------------------------------------------------------------------
1457
1458 inline mesh::Block *
1459 Mesh::block( const id_t aID )
1460 {
1462 "Tried to access invalid block id: %lu.",
1463 ( long unsigned int ) aID );
1464
1465 return mBlockMap( aID );
1466 }
1467
1468//------------------------------------------------------------------------------
1469
1470 inline mesh::SideSet *
1471 Mesh::sideset( const id_t aID )
1472 {
1474 "Tried to access invalid sideset id: %lu.",
1475 ( long unsigned int ) aID );
1476
1477 return mSideSetMap( aID );
1478 }
1479
1480//------------------------------------------------------------------------------
1481
1482 inline mesh::Element *
1483 Mesh::vertex( const id_t aID )
1484 {
1486 "Tried to access invalid vertex id: %lu.",
1487 ( long unsigned int ) aID );
1488
1489 return mVertexMap( aID );
1490 }
1491
1492//------------------------------------------------------------------------------
1493
1494 inline mesh::Field *
1495 Mesh::field( const index_t aIndex )
1496 {
1497 return mFields( aIndex );
1498 }
1499
1500//------------------------------------------------------------------------------
1501
1502 inline mesh::Field *
1503 Mesh::field( const string & aLabel )
1504 {
1506 "Field '%s' does not exist on mesh", aLabel.c_str());
1507
1508 return mFieldMap( aLabel );
1509 }
1510
1511//------------------------------------------------------------------------------
1512
1513 inline bool
1514 Mesh::field_exists( const string & aLabel )
1515 {
1516 return mFieldMap.key_exists( aLabel ) ;
1517 }
1518
1519
1520//------------------------------------------------------------------------------
1521
1522 inline Vector< real > &
1523 Mesh::field_data( const string & aLabel )
1524 {
1526 "Field '%s' does not exist on mesh", aLabel.c_str());
1527
1528 return mFieldMap( aLabel )->data();
1529 }
1530
1531//------------------------------------------------------------------------------
1532
1535 {
1536 return mGlobalVariables;
1537 }
1538
1539//------------------------------------------------------------------------------
1540
1541 inline mesh::GlobalVariable *
1543 {
1544 return mGlobalVariableIDMap( aID );
1545 }
1546
1547//------------------------------------------------------------------------------
1548
1549 inline mesh::GlobalVariable *
1550 Mesh::global_variable( const string & aLabel )
1551 {
1552 return mGlobalVariableMap( aLabel );
1553 }
1554
1555//------------------------------------------------------------------------------
1556
1557 inline real &
1558 Mesh::global_variable_data( const string & aLabel )
1559 {
1560 return mGlobalVariableMap( aLabel )->value();
1561 }
1562
1563//------------------------------------------------------------------------------
1564
1565 // test if a global variable has already been created
1566 inline bool
1567 Mesh::global_variable_exists( const string & aLabel )
1568 {
1569 return mGlobalVariableMap.key_exists( aLabel );
1570 }
1571
1572//------------------------------------------------------------------------------
1573
1574 inline uint
1576 {
1577 return mFields.size() ;
1578 }
1579
1580//------------------------------------------------------------------------------
1581
1582 inline uint
1584 {
1585 return mGlobalVariables.size();
1586 }
1587
1588//------------------------------------------------------------------------------
1589
1590 inline real &
1592 {
1593 return mTimeStamp;
1594 }
1595
1596//------------------------------------------------------------------------------
1597
1598 inline const uint &
1600 {
1601 return mTimeStep;
1602 }
1603
1604 inline uint &
1606 {
1607 return mTimeStep;
1608 }
1609
1610
1611//------------------------------------------------------------------------------
1612
1613 inline void
1614 Mesh::set_time_step( const uint aTimeStep )
1615 {
1616 mTimeStep = aTimeStep;
1617 }
1618
1619//------------------------------------------------------------------------------
1620
1621 inline void
1623 {
1624 mConnectivities.set( static_cast<index_t>( aConnectivity ));
1625 }
1626
1627//------------------------------------------------------------------------------
1628
1629 inline void
1631 {
1632 mConnectivities.reset( static_cast<index_t>( aConnectivity ));
1633 }
1634
1635//------------------------------------------------------------------------------
1636
1637 inline bool
1639 {
1640 return mConnectivities.test( static_cast<index_t>( aConnectivity ));
1641 }
1642
1643//------------------------------------------------------------------------------
1644
1645 inline const proc_t &
1647 {
1648 return mMasterProc;
1649 }
1650
1651//------------------------------------------------------------------------------
1652
1653 inline void
1654 Mesh::set_number_of_partitions( const proc_t & aNumberOfPartitions )
1655 {
1656 mNumberOfPartitions = aNumberOfPartitions;
1657 }
1658
1659//------------------------------------------------------------------------------
1660
1661 inline bool
1662 Mesh::block_exists( const id_t aID ) const
1663 {
1664 return mBlockMap.key_exists( aID );
1665 }
1666
1667//------------------------------------------------------------------------------
1668
1669 inline bool
1670 Mesh::sideset_exists( const id_t aID ) const
1671 {
1672 return mSideSetMap.key_exists( aID );
1673 }
1674
1675//------------------------------------------------------------------------------
1676
1677 inline bool
1678 Mesh::node_exists( const id_t aID ) const
1679 {
1680 return mNodeMap.key_exists( aID );
1681 }
1682
1683//------------------------------------------------------------------------------
1684
1685 inline bool
1687 {
1688 return mEdges.size() > 0 ;
1689 }
1690
1691//------------------------------------------------------------------------------
1692
1693 inline bool
1695 {
1696 return mFaces.size() > 0 ;
1697 }
1698
1699//------------------------------------------------------------------------------
1700
1701 inline const uint &
1703 {
1704 return mMaxElementOrder;
1705 }
1706
1707//------------------------------------------------------------------------------
1708
1709 inline Cell< mesh::Node * > &
1711 {
1712 return mNodes;
1713 }
1714
1715//------------------------------------------------------------------------------
1716
1717 inline Cell< mesh::Block * > &
1719 {
1720 return mBlocks;
1721 }
1722
1723
1724//------------------------------------------------------------------------------
1725
1728 {
1729 return mSideSets;
1730 }
1731
1732//------------------------------------------------------------------------------
1733
1734 inline Cell< mesh::Curve * > &
1736 {
1737 return mCurves;
1738 }
1739
1740//------------------------------------------------------------------------------
1741
1742 inline mesh::Curve *
1743 Mesh::curve( const id_t aID )
1744 {
1745 return mCurveMap( aID );
1746 }
1747
1748
1749//------------------------------------------------------------------------------
1750
1753 {
1754 return mThinShells;
1755 }
1756
1757//------------------------------------------------------------------------------
1758
1761 {
1762 return mElements;
1763 }
1764
1765//------------------------------------------------------------------------------
1766
1767 inline Cell< mesh::Facet * > &
1769 {
1770 return mFacets ;
1771 }
1772
1775 {
1776 return mControlPoints;
1777 }
1778
1779//------------------------------------------------------------------------------
1780
1781 inline Cell< mesh::Edge * > &
1783 {
1784 return mEdges ;
1785 }
1786
1787//------------------------------------------------------------------------------
1788
1789 inline Cell< mesh::Face * > &
1791 {
1792 return mFaces ;
1793 }
1794
1795//------------------------------------------------------------------------------
1796
1799 {
1800 return mBoundaryEdges;
1801 }
1802
1803//------------------------------------------------------------------------------
1804
1807 {
1808 return mVertices;
1809 }
1810
1811//------------------------------------------------------------------------------
1812
1813 inline void
1815 {
1816 mIsKernelMesh = true ;
1817 }
1818
1819//------------------------------------------------------------------------------
1820
1821 inline bool
1823 {
1824 return mIsKernelMesh ;
1825 }
1826
1827//------------------------------------------------------------------------------
1828
1829 inline Cell< mesh::Node * > &
1831 {
1832 return mAutoPins ;
1833 }
1834
1835//------------------------------------------------------------------------------
1836
1837 inline Cell< mesh::Node * > &
1839 {
1840 return mAbstractNodes ;
1841 }
1842
1843//------------------------------------------------------------------------------
1844
1845 inline Cell< mesh::Node * > &
1847 {
1848 return mOrphanedNodes ;
1849 }
1850
1851//------------------------------------------------------------------------------
1852
1853 inline mesh::Basis *
1854 Mesh::basis_by_index( const EntityType aType, const index_t aIndex )
1855 {
1856 switch ( aType )
1857 {
1858 case EntityType::NODE :
1859 {
1860 return mNodes( aIndex );
1861 }
1862 case EntityType::EDGE :
1863 {
1864 return mEdges( aIndex );
1865 }
1866 case EntityType::FACE :
1867 {
1868 return mFaces( aIndex );
1869 }
1870 case EntityType::ELEMENT :
1871 {
1872 return mElements( aIndex );
1873 }
1874 case EntityType::FACET :
1875 {
1876 return mFacets( aIndex );
1877 }
1879 {
1880 return mControlPoints( aIndex );
1881 }
1882 default:
1883 {
1884 BELFEM_ERROR( false, "Invalid entity type" );
1885 return nullptr;
1886 }
1887 }
1888
1889 }
1890
1891 inline mesh::Basis* Mesh::basis( const EntityType aType, const id_t aID )
1892 {
1893 switch ( aType )
1894 {
1895 case EntityType::NODE :
1896 {
1897 return this->node( aID );
1898 }
1899 case EntityType::EDGE :
1900 {
1901 return this->edge( aID );
1902 }
1903 case EntityType::FACE :
1904 {
1905 return this->face( aID );
1906 }
1907 case EntityType::ELEMENT :
1908 {
1909 return this->element( aID );
1910 }
1911 case EntityType::FACET :
1912 {
1913 return this->facet( aID );
1914 }
1916 {
1917 return this->control_point( aID );
1918 }
1919 default:
1920 {
1921 BELFEM_ERROR( false, "Invalid entity type" );
1922 return nullptr;
1923 }
1924 }
1925 }
1926
1927 inline void
1932
1933 inline bool
1935 {
1936 return mIsFinalized ;
1937 }
1938
1939 inline bool
1941 {
1942 return mEdgesAreFinalized ;
1943 }
1944
1945
1946 inline bool
1948 {
1949 return mFacesAreFinalized ;
1950 }
1951
1952
1953//------------------------------------------------------------------------------
1954
1961
1962 inline index_t
1972
1973
1974 inline void
1976 {
1977 BELFEM_ASSERT( mPeriodicity == nullptr, "Periodicity object has already been set for this mesh" );
1978 mPeriodicity = aPeriodicity;
1979 }
1980
1981 inline bool
1983 {
1984 return mPeriodicity != nullptr;
1985 }
1986
1987 inline mesh::Periodicity *
1989 {
1990 BELFEM_ASSERT( mPeriodicity != nullptr, "Periodicity object has not been set for this mesh" );
1991
1992 return mPeriodicity;
1993 }
1994
1995
1996 inline void
1998 {
1999 mMeshCheckerFlag = true;
2000 }
2001
2002 inline void
2007
2008 inline bool
2010 {
2011 return mMeshCheckerFlag;
2012 }
2013
2014
2015 namespace mesh
2016 {
2017 template< typename T >
2018 void
2019 collect_hanging_basis( Cell< T * > & aBasis, Cell< T * > & aHangingBasis )
2020 {
2021 index_t tCount = 0 ;
2022 for( T * tBasis : aBasis )
2023 {
2024 if( tBasis->is_hanging() )
2025 {
2026 ++tCount ;
2027 }
2028 }
2029
2030 if( tCount == 0 )
2031 {
2032 aHangingBasis.clear();
2033 }
2034 else
2035 {
2036 aHangingBasis.set_size( tCount, nullptr );
2037 tCount = 0;
2038 for ( T * tBasis: aBasis )
2039 {
2040 if ( tBasis->is_hanging())
2041 {
2042 aHangingBasis( tCount++ ) = tBasis;
2043 }
2044 }
2045 }
2046 }
2047
2048//------------------------------------------------------------------------------
2049
2050//------------------------------------------------------------------------------
2051 }
2052}
2053
2054#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
A bounds-checked wrapper around std::vector.
Definition cl_Cell.hpp:45
void set_size(const size_t aSize)
New elements are value-initialized ( zero for arithmetic T, nullptr for pointers ).
Definition cl_Cell.hpp:199
size_t size() const
Definition cl_Cell.hpp:189
void clear()
Empties the Cell.
Definition cl_Cell.hpp:249
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:101
Cell< mesh::ControlPoint * > & control_points()
Owned and deleted by the mesh.
Definition cl_Mesh.hpp:1774
Cell< mesh::Edge * > mHangingEdges
Definition cl_Mesh.hpp:98
mesh::Field * field(const string &aLabel)
get field by label
Definition cl_Mesh.hpp:1503
void update_facet_indices()
Definition cl_Mesh.cpp:453
const proc_t mCommSize
Definition cl_Mesh.hpp:68
bool mEdgesAreFinalized
Definition cl_Mesh.hpp:150
Cell< mesh::Element * > & vertices()
Owned and deleted by the mesh.
Definition cl_Mesh.hpp:1806
void set_kernel_flag()
called by kernel
Definition cl_Mesh.hpp:1814
void set_periodicity(mesh::Periodicity *aPeriodicity)
The mesh takes ownership and deletes aPeriodicity.
Definition cl_Mesh.hpp:1975
bool mesh_checker_flag() const
Definition cl_Mesh.hpp:2009
Cell< mesh::Curve * > & curves()
Owned and deleted by the mesh.
Definition cl_Mesh.hpp:1735
void update_sideset_map()
Definition cl_Mesh.cpp:2367
void unflag_all_nodes(const uint aFlagIndex=0)
Definition cl_Mesh.cpp:1038
Map< id_t, mesh::Element * > mElementMap
Definition cl_Mesh.hpp:132
Cell< mesh::Facet * > mFacets
Definition cl_Mesh.hpp:87
void add_sideset(mesh::SideSet *aSideSet)
Takes ownership of aSideSet: ~Mesh deletes the sideset and, through it, its facets.
Definition cl_Mesh.cpp:2182
Cell< mesh::Node * > & hanging_nodes()
Returns views of entities the mesh owns through the containers below.
Definition cl_Mesh.hpp:1955
index_t number_of_faces() const
Definition cl_Mesh.hpp:1274
void set_vertex_owners()
Definition cl_Mesh.cpp:1648
Map< id_t, mesh::GlobalVariable * > mGlobalVariableIDMap
Definition cl_Mesh.hpp:113
Cell< mesh::ControlPoint * > mHangingControlPoints
Definition cl_Mesh.hpp:102
Map< id_t, mesh::ControlPoint * > mControlPointMap
Definition cl_Mesh.hpp:139
void create_edge_map()
special function called by Kernel
Definition cl_Mesh.cpp:1540
mesh::Edge * edge(const id_t aID)
Definition cl_Mesh.hpp:1339
void update_element_indices()
Definition cl_Mesh.cpp:466
void update_element_map()
Definition cl_Mesh.cpp:2344
const uint & time_step() const
The current timestep index.
Definition cl_Mesh.hpp:1599
bool facet_exists(const id_t aID) const
Definition cl_Mesh.hpp:1439
proc_t mNumberOfPartitions
Definition cl_Mesh.hpp:117
Cell< mesh::Node * > & autopins()
Definition cl_Mesh.hpp:1830
void create_curve_map()
Definition cl_Mesh.cpp:2698
index_t number_of_facets() const
Definition cl_Mesh.hpp:1258
void unflag_all_control_points(const uint aFlagIndex=0)
Definition cl_Mesh.cpp:1189
Cell< mesh::Block * > mBlocks
Definition cl_Mesh.hpp:104
Cell< mesh::Face * > & faces()
Owned and deleted by the mesh.
Definition cl_Mesh.hpp:1790
Cell< mesh::Element * > mVertices
Definition cl_Mesh.hpp:88
Cell< mesh::Element * > mBoundaryEdges
Definition cl_Mesh.hpp:95
index_t number_of_elements() const
Definition cl_Mesh.hpp:1250
void compute_facet_orientations()
Definition cl_Mesh.cpp:733
bool node_exists(const id_t aID) const
Definition cl_Mesh.hpp:1678
uint load_meta(hid_t aFile)
Definition cl_Mesh.cpp:2896
void populate_element_neighbors()
Definition cl_Mesh.cpp:2552
Map< id_t, mesh::Node * > mNodeMap
Definition cl_Mesh.hpp:131
void finalize_faces()
Definition cl_Mesh.cpp:981
void update_block_map()
Definition cl_Mesh.cpp:2357
void unflag_all_faces(const uint aFlagIndex=0)
Definition cl_Mesh.cpp:1096
void update_facet_nodes()
Definition cl_Mesh.cpp:648
Cell< mesh::Facet * > mHangingFacets
Definition cl_Mesh.hpp:100
bool global_variable_exists(const string &aLabel)
Definition cl_Mesh.hpp:1567
uint mNumberOfGlobalVariables
Definition cl_Mesh.hpp:120
void save_meta(hid_t aFile, const uint aRunningTimestep=0)
Definition cl_Mesh.cpp:2879
void save_globals(hid_t aFile)
Definition cl_Mesh.cpp:2952
bool mMeshCheckerFlag
Definition cl_Mesh.hpp:174
void distribute_edge_directions()
Collective and asymmetric: every rank must enter; rank 0 distributes the per-owner edge signs,...
Definition cl_Mesh.cpp:1784
void set_time_step(const uint aTimeStep)
set the index of the time step
Definition cl_Mesh.hpp:1614
void collect_facets_from_sidesets()
Definition cl_Mesh.cpp:617
Cell< mesh::SideSet * > & sidesets()
The mesh owns the sidesets; a sideset owns and deletes its facets.
Definition cl_Mesh.hpp:1727
uint number_of_fields() const
Definition cl_Mesh.hpp:1575
const string & path() const
Definition cl_Mesh.hpp:1202
Vector< real > & field_data(const string &aLabel)
Definition cl_Mesh.hpp:1523
Map< id_t, mesh::Block * > mBlockMap
Definition cl_Mesh.hpp:134
uint64_t config_tag() const
Definition cl_Mesh.cpp:2288
const proc_t mMasterProc
Definition cl_Mesh.hpp:66
uint number_of_sidesets() const
Definition cl_Mesh.hpp:1298
Cell< mesh::Facet * > & facets()
A flat list of the facets of all sidesets.
Definition cl_Mesh.hpp:1768
id_t max_block_and_sideset_id()
Definition cl_Mesh.cpp:2136
uint number_of_dimensions() const
Definition cl_Mesh.hpp:1226
Cell< mesh::Node * > mAbstractNodes
Definition cl_Mesh.hpp:165
void save(const string &aFilePath)
Master rank only, a no-op elsewhere; the mesh must be finalized.
Definition cl_Mesh.cpp:336
void update_node_indices()
Definition cl_Mesh.cpp:417
void unflag_all_elements(const uint aFlagIndex=0)
Definition cl_Mesh.cpp:1152
void update_face_indices()
Definition cl_Mesh.cpp:441
index_t number_of_edges() const
Definition cl_Mesh.hpp:1266
bool block_exists(const id_t aID) const
Definition cl_Mesh.hpp:1662
Cell< mesh::ThinShell * > & thin_shells()
Owned and deleted by the mesh.
Definition cl_Mesh.hpp:1752
id_t max_element_id()
Definition cl_Mesh.cpp:2081
void set_compute_facet_orientation_flag(const bool aFlag)
Definition cl_Mesh.hpp:1928
void load_globals(hid_t aFile)
Definition cl_Mesh.cpp:2976
void collect_elements_from_blocks()
Definition cl_Mesh.cpp:583
void reset_connectivity(const Connectivity aConnectivity)
Definition cl_Mesh.hpp:1630
bool mIsKernelMesh
flag telling if this is a mesh on the kernel
Definition cl_Mesh.hpp:146
bool edges_exist() const
tells if Nedelec edges exist on this mesh
Definition cl_Mesh.hpp:1686
Cell< mesh::Node * > mOrphanedNodes
Definition cl_Mesh.hpp:166
const TensorMeshConfig * mTensorConfig
Definition cl_Mesh.hpp:170
void update_edge_indices()
Definition cl_Mesh.cpp:429
real & create_global_variable(const string &aLabel, const real aValue=0.0, const id_t aID=0)
Definition cl_Mesh.cpp:544
mesh::Periodicity * mPeriodicity
Definition cl_Mesh.hpp:172
mesh::Block * block(const id_t aID)
Definition cl_Mesh.hpp:1459
string mPath
Definition cl_Mesh.hpp:83
void update_vertex_indices()
Definition cl_Mesh.cpp:478
Bitset< static_cast< size_t >(Connectivity::UNDEFINED)> mConnectivities
Definition cl_Mesh.hpp:168
void set_number_of_partitions(const proc_t &aNumberOfPartitions)
to be called by partitioner
Definition cl_Mesh.hpp:1654
uint mNumberOfFields
Definition cl_Mesh.hpp:121
mesh::Curve * curve(const id_t aID)
return a curve by its ID
Definition cl_Mesh.hpp:1743
bool mNodesAreSorted
Definition cl_Mesh.hpp:154
Cell< mesh::Block * > & blocks()
The mesh owns the blocks; a block owns and deletes its elements.
Definition cl_Mesh.hpp:1718
Vector< real > & create_field(const string &aLabel, const EntityType aEntity=EntityType::NODE, const id_t aID=0)
Definition cl_Mesh.cpp:501
mesh::Basis * basis_by_index(const EntityType aType, const index_t aIndex)
Definition cl_Mesh.hpp:1854
bool has_periodicity() const
Definition cl_Mesh.hpp:1982
bool edges_are_finalized() const
Definition cl_Mesh.hpp:1940
void reset_faces()
Definition cl_Mesh.cpp:1401
mesh::SideSet * sideset(const id_t aID)
Definition cl_Mesh.hpp:1471
Map< id_t, mesh::Edge * > mEdgeMap
Definition cl_Mesh.hpp:137
bool mFacesAreFinalized
Definition cl_Mesh.hpp:151
real mTimeStamp
Definition cl_Mesh.hpp:123
mesh::Node * node(const id_t aID)
Definition cl_Mesh.hpp:1306
bool is_kernel_mesh() const
Definition cl_Mesh.hpp:1822
Cell< mesh::Node * > & nodes()
The nodes.
Definition cl_Mesh.hpp:1710
bool is_finalized() const
Definition cl_Mesh.hpp:1934
Cell< mesh::Element * > & hanging_elements()
Definition cl_Mesh.hpp:1959
mesh::Element * vertex(const id_t aID)
Definition cl_Mesh.hpp:1483
void create_face_map()
special function called by Kernel
Definition cl_Mesh.cpp:1553
mesh::GlobalVariable * global_variable(const id_t aID)
Definition cl_Mesh.hpp:1542
real & time_stamp()
Writable reference to the current time [s].
Definition cl_Mesh.hpp:1591
void collect_elements_from_group(Cell< mesh::Element * > &aElements, const id_t aGroupId, const ElementType aType=ElementType::EMPTY)
Definition cl_Mesh.cpp:681
Map< string, mesh::GlobalVariable * > mGlobalVariableMap
Definition cl_Mesh.hpp:112
std::size_t checksum()
Definition cl_Mesh.cpp:2259
void unfinalize()
unfinalizes all aspects of mesh but edges
Definition cl_Mesh.cpp:839
void save_fields(hid_t aFile)
Definition cl_Mesh.cpp:2934
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:1456
void expand_hanging_basis_sources()
Definition cl_Mesh.cpp:2029
void unflag_all_edges(const uint aFlagIndex=0)
Definition cl_Mesh.cpp:1065
bool faces_exist() const
tells if Nedelec faces exist on this mesh
Definition cl_Mesh.hpp:1694
bool faces_are_finalized() const
Definition cl_Mesh.hpp:1947
mesh::Periodicity * periodicity()
Definition cl_Mesh.hpp:1988
uint number_of_blocks() const
Definition cl_Mesh.hpp:1290
void set_number_of_dimensions(const uint &aNumberOfDimensions)
Definition cl_Mesh.hpp:1234
size_t memory() const
Compute the total memory used by the mesh in bytes.
Definition cl_Mesh.cpp:2710
const proc_t mCommRank
Definition cl_Mesh.hpp:67
bool sideset_exists(const id_t aID) const
Definition cl_Mesh.hpp:1670
Map< id_t, mesh::Facet * > mFacetMap
Definition cl_Mesh.hpp:133
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:1323
uint number_of_global_variables() const
Definition cl_Mesh.hpp:1583
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)
Only the master rank partitions the mesh and sets the element and node ownerships.
Definition cl_Mesh.cpp:1200
uint mNumberOfDimensions
Definition cl_Mesh.hpp:119
Cell< mesh::Field * > mFields
Definition cl_Mesh.hpp:110
Cell< mesh::Element * > & elements()
A flat list of the elements of all blocks.
Definition cl_Mesh.hpp:1760
string mConfigText
Definition cl_Mesh.hpp:81
void unflag_all_facets(const uint aFlagIndex=0)
Definition cl_Mesh.cpp:1126
mesh::Facet * facet(const id_t aID)
Definition cl_Mesh.hpp:1447
const TensorMeshConfig * tensorconf() const
Definition cl_Mesh.hpp:1218
void save_faces(const string &aPath)
Definition cl_Mesh.cpp:1871
Cell< mesh::GlobalVariable * > & global_variables()
Definition cl_Mesh.hpp:1534
Map< id_t, mesh::Element * > mVertexMap
Definition cl_Mesh.hpp:136
void scale_mesh(const real aFactor)
Multiplies the node and control-point coordinates by aFactor, e.g.
Definition cl_Mesh.cpp:298
uint mMaxElementOrder
Definition cl_Mesh.hpp:143
mesh::Element * element(const id_t aID)
Definition cl_Mesh.hpp:1371
Map< id_t, mesh::Curve * > mCurveMap
Definition cl_Mesh.hpp:140
bool field_exists(const string &aLabel)
Definition cl_Mesh.hpp:1514
Cell< mesh::SideSet * > mSideSets
Definition cl_Mesh.hpp:105
void reset_mesh_checker_flag()
Definition cl_Mesh.hpp:2003
void update_control_point_indices()
Definition cl_Mesh.cpp:490
void set_connectivity(const Connectivity aConnectivity)
Definition cl_Mesh.hpp:1622
mesh::Basis * basis(const EntityType aType, const id_t aID)
Definition cl_Mesh.hpp:1891
const proc_t & master() const
return the ID of the proc that owns this mesh
Definition cl_Mesh.hpp:1646
mesh::Face * face(const id_t aID)
Definition cl_Mesh.hpp:1351
Cell< mesh::ControlPoint * > mControlPoints
Definition cl_Mesh.hpp:91
Map< string, mesh::Field * > mFieldMap
Definition cl_Mesh.hpp:114
void reset_edges()
Definition cl_Mesh.cpp:1346
Cell< mesh::Node * > mHangingNodes
Definition cl_Mesh.hpp:97
Cell< mesh::Node * > & orphaned_nodes()
Definition cl_Mesh.hpp:1846
Cell< mesh::Curve * > mCurves
Definition cl_Mesh.hpp:106
void set_mesh_checker_flag()
Definition cl_Mesh.hpp:1997
void set_abstract_nodes(Cell< mesh::Node * > &aNodes)
Adopts the nodes.
Definition cl_Mesh.cpp:2202
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:1282
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:82
void finalize()
finalizes all aspects of the mesh; edges and faces are finalized too when connectivities are computed
Definition cl_Mesh.cpp:746
mesh::ControlPoint * control_point(const id_t aID)
Definition cl_Mesh.hpp:1405
Cell< mesh::ControlPoint * > & hanging_control_points()
Definition cl_Mesh.hpp:1960
Cell< mesh::Face * > & hanging_faces()
Definition cl_Mesh.hpp:1957
const string & config_text() const
Definition cl_Mesh.cpp:2296
Cell< mesh::GlobalVariable * > mGlobalVariables
Definition cl_Mesh.hpp:109
void flag_curved_elements()
flags elements that are curved
Definition cl_Mesh.cpp:1720
void load_fields(hid_t aFile)
Definition cl_Mesh.cpp:3021
uint64_t mConfigTag
Definition cl_Mesh.hpp:80
void finalize_edges()
Definition cl_Mesh.cpp:934
bool test_connectivity(const Connectivity aConnectivity)
Definition cl_Mesh.hpp:1638
Cell< mesh::Node * > & abstract_nodes()
Definition cl_Mesh.hpp:1838
void collect_hanging_basis()
Definition cl_Mesh.cpp:2017
Cell< mesh::Node * > mNodes
Definition cl_Mesh.hpp:86
real & global_variable_data(const string &aLabel)
Definition cl_Mesh.hpp:1558
id_t max_node_id()
Definition cl_Mesh.cpp:2065
Cell< mesh::Node * > mAutoPins
Definition cl_Mesh.hpp:164
void update_ownerships()
Definition cl_Mesh.cpp:1580
Cell< mesh::ThinShell * > mThinShells
Definition cl_Mesh.hpp:107
Map< id_t, mesh::SideSet * > mSideSetMap
Definition cl_Mesh.hpp:135
const uint & max_element_order() const
return the max interpolation order on the mesh
Definition cl_Mesh.hpp:1702
uint mTimeStep
Definition cl_Mesh.hpp:124
void unflag_everything(const uint aFlagIndex=0)
Definition cl_Mesh.cpp:1024
bool element_exists(const id_t aID) const
Definition cl_Mesh.hpp:1363
Cell< mesh::Face * > mHangingFaces
Definition cl_Mesh.hpp:99
void unflag_all_vertices(const uint aFlagIndex=0)
Definition cl_Mesh.cpp:1178
bool is_tensormesh() const
Definition cl_Mesh.hpp:1210
bool mComputeFacetOrientationsWhenFinalizing
Definition cl_Mesh.hpp:157
index_t number_of_hanging_basis() const
Definition cl_Mesh.hpp:1963
Cell< mesh::Edge * > & hanging_edges()
Definition cl_Mesh.hpp:1956
Cell< mesh::Element * > & boundary_edges()
The line elements of a 3D Gmsh mesh; owned and deleted by the mesh.
Definition cl_Mesh.hpp:1798
bool mIsFinalized
flag telling if mesh is finalized (master only)
Definition cl_Mesh.hpp:149
void add_block(mesh::Block *aBlock)
Takes ownership of aBlock: ~Mesh deletes the block and, through it, its elements.
Definition cl_Mesh.cpp:2173
void set_config_tag(const uint64_t aTag, const string &aText)
Definition cl_Mesh.cpp:2279
Cell< mesh::Facet * > & hanging_facets()
Definition cl_Mesh.hpp:1958
Map< id_t, mesh::Face * > mFaceMap
Definition cl_Mesh.hpp:138
index_t number_of_nodes() const
Definition cl_Mesh.hpp:1242
Cell< mesh::Element * > mElements
Definition cl_Mesh.hpp:85
Cell< mesh::Edge * > & edges()
Owned and deleted by the mesh.
Definition cl_Mesh.hpp:1782
void force_checksum(const std::size_t aChecksum)
Definition cl_Mesh.cpp:2271
Mesh * extract_thin_shell_mesh()
Returns a newly allocated mesh the caller owns and deletes.
Definition cl_Mesh.cpp:2456
Definition cl_TensorMeshConfig.hpp:25
uint num_control_points(const uint aDimension=BELFEM_UINT_MAX) const
Definition cl_TensorMeshConfig.hpp:127
index_t node_index(const index_t i, const index_t j) const
Definition cl_TensorMeshConfig.hpp:158
index_t element_index(const index_t i, const index_t j) const
Definition cl_TensorMeshConfig.hpp:178
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:24
void collect_hanging_basis(Cell< T * > &aBasis, Cell< T * > &aHangingBasis)
Definition cl_Mesh.hpp:2019
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