Flow123d
JS_before_hm-1728-g5d7ebd453
|
Go to the documentation of this file.
21 #include <unordered_map>
67 "Use BIH for finding initial candidates, then continue by prolongation.")
69 "Use BIH for finding all candidates.")
71 "Use bounding boxes for finding initial candidates, then continue by prolongation.")
76 return IT::Record(
"Mesh",
"Record with mesh related data." )
79 "Input file with mesh description.")
81 "List of additional region and region set definitions not contained in the mesh. "
82 "There are three region sets implicitly defined:\n\n"
83 "- ALL (all regions of the mesh)\n"
84 "- .BOUNDARY (all boundary regions)\n"
85 "- BULK (all bulk regions)")
89 IT::Default(
"\"BIHsearch\""),
"Search algorithm for element intersections.")
91 "Maximal snapping distance from the mesh in various search operations. In particular, it is used "
92 "to find the closest mesh element of an observe point; and in FieldFormula to find closest surface "
93 "element in plan view (Z projection).")
95 "Output file with neighboring data from mesh.")
97 "This will speed up the calculations in assembations.")
105 optimize_memory_locality(true),
112 node_4_loc_(nullptr),
122 optimize_memory_locality(true),
123 in_record_(in_record),
130 node_4_loc_(nullptr),
148 istringstream is(
"{mesh_file=\"\"}");
180 for(
int dim=0; dim < 3; dim++) {
182 for(
int i_side=0; i_side < dim+2; i_side++)
186 for (
unsigned int sid=0; sid<RefElement<1>::n_sides; sid++)
187 for (
unsigned int nid=0; nid<RefElement<1>::n_nodes_per_side; nid++)
190 for (
unsigned int sid=0; sid<RefElement<2>::n_sides; sid++)
191 for (
unsigned int nid=0; nid<RefElement<2>::n_nodes_per_side; nid++)
194 for (
unsigned int sid=0; sid<RefElement<3>::n_sides; sid++)
195 for (
unsigned int nid=0; nid<RefElement<3>::n_nodes_per_side; nid++)
202 if (edg.side_)
delete[] edg.side_;
204 for (
unsigned int idx=0; idx <
bulk_size_; idx++) {
240 unsigned int li, count = 0;
242 for (li=0; li<ele->n_nodes(); li++) {
252 return Edge(
this, edge_idx);
276 switch (elm->dim()) {
295 std::string reg_name =
"UndefinedRegion";
298 dim_to_check = ele.
dim();
302 for (
auto elem_to_region :
map) {
305 if( ele.
dim() != dim_to_check){
306 THROW(ExcRegionElmDiffDim() << EI_Region(reg_name) << EI_RegIdx(elem_to_region.second) << EI_Dim(dim_to_check)
307 << EI_DimOther(ele.
dim()) << EI_ElemId(elem_to_region.first) );
322 double quality = ele.quality_measure_smooth();
324 WarningOut().fmt(
"Bad quality (<0.001) of the element {}.\n", ele.idx());
327 for (
uint ele_node=0; ele_node<ele->n_nodes(); ele_node++) {
328 uint inode = ele->node_idx(ele_node);
329 nodes_new_idx[inode] = inode;
339 for(
uint inode = 0; inode < nodes_new_idx.size(); inode++) {
341 WarningOut().fmt(
"A node {} does not belong to any element "
342 " and will be removed.",
347 nodes_new_idx[inode] = inode_new;
357 uint n_nodes_new = inode_new;
360 if(n_nodes_new < nodes_new_idx.size()){
362 DebugOut() <<
"Updating node-element numbering due to unused nodes: "
371 for (
uint ele_node=0; ele_node<ele->n_nodes(); ele_node++) {
372 uint inode_orig = ele->node_idx(ele_node);
373 uint inode = nodes_new_idx[inode_orig];
375 const_cast<Element*
>(ele.element())->
nodes_[ele_node] = inode;
406 id_4_old[i++] = ele.idx();
473 for (
unsigned int n=0; n<ele->n_nodes(); n++)
477 stable_sort(n->begin(), n->end());
487 if (nodes_list.size() == 0) {
488 intersection_element_list.clear();
489 }
else if (nodes_list.size() == 1) {
496 it1=set_intersection(
499 intersection_element_list.begin());
500 intersection_element_list.resize(it1-intersection_element_list.begin());
502 for(;it2<nodes_list.end();++it2) {
503 it1=set_intersection(
504 intersection_element_list.begin(), intersection_element_list.end(),
506 intersection_element_list.begin());
507 intersection_element_list.resize(it1-intersection_element_list.begin());
514 bool is_neighbour =
false;
522 if (is_neighbour)
THROW(ExcTooMatchingIds() << EI_ElemId(this->
elem_index(*ele)) << EI_ElemIdOther(this->
elem_index(element_idx)) );
528 element_list.resize( e_dest - element_list.begin());
537 return ( ni == si->
n_nodes() );
552 .error(
"Temporary structure of boundary element data is not empty. Did you call create_boundary_elements?");
556 unsigned int ngh_element_idx;
559 neighbour.
mesh_ =
this;
580 THROW( ExcBdrElemMatchRegular() << EI_ElemId(bc_ele.
idx()) << EI_ElemIdOther(this->
elem_index(ngh_element_idx)) );
582 if (intersection_list.size() == 0) {
584 WarningOut().fmt(
"Lonely boundary element, id: {}, region: {}, dimension {}.\n",
588 last_edge_idx=
edges.size();
589 edges.resize(last_edge_idx+1);
590 edg = &(
edges.back() );
592 edg->
side_ =
new struct SideIter[ intersection_list.size() ];
606 for (
unsigned int ecs=0; ecs<elem->
n_sides(); ecs++) {
612 int new_bc_ele_idx=i;
613 THROW( ExcDuplicateBoundary()
640 for (
unsigned int s=0; s<e->n_sides(); s++)
648 for (
unsigned n=0; n<e.side(s)->
n_nodes(); n++)
side_nodes[n] = e.side(s)->node(n).idx();
658 last_edge_idx=
edges.size();
659 edges.resize(last_edge_idx+1);
660 edg = &(
edges.back() );
662 edg->
side_ =
new struct SideIter[ intersection_list.size() ];
666 if (intersection_list.size() == 1) {
670 edg->
side_[0] = e.side(s);
673 if (e->boundary_idx_ == NULL) {
704 for (
unsigned int ecs=0; ecs<elem->
n_sides(); ecs++) {
710 last_edge_idx=
edges.size();
711 edges.resize(last_edge_idx+1);
712 edg = &(
edges.back() );
734 ASSERT_EQ( (
unsigned int) edg->
n_sides, intersection_list.size())(e.index())(s).error(
"Missing edge sides.");
747 std::unordered_map<unsigned int,unsigned int> node_numbers;
751 unsigned int n_side_nodes = edg.side(0)->n_nodes();
753 edg.side(0)->element()->permutation_idx_[edg.side(0)->side_idx()] = 0;
755 if (edg.n_sides() > 1)
758 unsigned int permutation[n_side_nodes];
761 node_numbers.clear();
762 for (
uint i=0; i<n_side_nodes; i++)
763 node_numbers[edg.side(0)->node(i).idx()] = i;
765 for (
uint sid=1; sid<edg.n_sides(); sid++)
767 for (
uint i=0; i<n_side_nodes; i++)
768 permutation[node_numbers[edg.side(sid)->node(i).idx()]] = i;
770 switch (edg.side(0)->dim())
790 unsigned int n_side_nodes = nb->element()->n_nodes();
791 unsigned int permutation[n_side_nodes];
792 node_numbers.clear();
796 for (
unsigned int i=0; i<n_side_nodes; i++)
797 node_numbers[nb->element().node(i).idx()] = i;
799 for (
unsigned int i=0; i<n_side_nodes; i++)
800 permutation[node_numbers[nb->side()->node(i).idx()]] = i;
802 switch (nb->side()->dim())
819 Edge edg = this->
edge(bdr->edge_idx_);
824 unsigned int n_side_nodes = bdr_elm->
n_nodes();
825 unsigned int permutation[n_side_nodes];
826 node_numbers.clear();
830 for (
unsigned int i=0; i<n_side_nodes; i++) {
831 node_numbers[bdr_elm.
node(i).idx()] = i;
836 for (
uint i=0; i<n_side_nodes; i++) {
837 permutation[node_numbers[edg.
side(sid)->
node(i).idx()]] = i;
840 switch (bdr_elm.
dim())
869 ele->n_neighs_vb_ =0;
872 for (
auto & ngh : this->
vb_neighbours_) ngh.element()->n_neighs_vb_++;
876 if( ele->n_neighs_vb() > 0 ) {
877 ele->neigh_vb =
new struct Neighbour* [ele->n_neighs_vb()];
883 for (
auto & ngh : this->vb_neighbours_) {
905 intersections = std::make_shared<MixedMeshIntersections>(
this);
927 if (bulk_elements_id.size() ==0) {
932 map_it = bulk_elements_id.begin();
934 for(
unsigned int idx=0; idx <
n_elements(); idx++, ++map_it) {
936 last_id=*map_it = id;
938 std::sort(bulk_elements_id.begin(), bulk_elements_id.end());
941 map_it = boundary_elements_id.begin();
948 if (
id < 0) last_id=*map_it=-1;
950 if (last_id >=
id)
THROW( ExcElmWrongOrder() << EI_ElemId(
id) );
951 last_id=*map_it = id;
959 static const double point_tolerance = 1E-10;
960 return fabs(p1[0]-p2[0]) < point_tolerance
961 && fabs(p1[1]-p2[1]) < point_tolerance
962 && fabs(p1[2]-p2[2]) < point_tolerance;
973 std::shared_ptr<std::vector<LongIdx>> map_ptr = std::make_shared<std::vector<LongIdx>>(
element_vec_.size());
981 unsigned int i_node, i_elm_node;
993 for (i_node=0; i_node<ele->
n_nodes(); i_node++)
995 static const double point_tolerance = 1E-10;
996 if ( arma::norm(*ele.
node(i_node) - *nod, 1) < point_tolerance) {
997 i_elm_node = ele.
node(i_node).idx();
999 else if (found_i_node != i_elm_node) {
1001 return std::make_shared<std::vector<LongIdx>>(0);
1007 searched_elements.clear();
1017 unsigned int n_found=0;
1021 for (
unsigned int j=0; j<elm->n_nodes(); j++) {
1022 if (node_ids[ elm->node_idx(j) ] ==
Mesh::undef_idx) valid_nodes =
false;
1023 node_list.push_back( node_ids[ elm->node_idx(j) ] );
1027 for (
auto i_elm : candidate_list) {
1028 if ( input_mesh.
element_accessor(i_elm)->
dim() == elm.dim() ) result_list.push_back(i_elm);
1031 if (result_list.size() == 1) {
1032 element_ids_map[i] = (
LongIdx)result_list[0];
1038 result_list.clear();
1044 return std::make_shared<std::vector<LongIdx>>(0);
1058 for (
auto elm : bc_mesh->elements_range()) {
1060 for (
unsigned int j=0; j<elm->n_nodes(); j++) {
1061 if (node_ids[ elm->node_idx(j) ] ==
Mesh::undef_idx) valid_nodes =
false;
1062 node_list.push_back( node_ids[ elm->node_idx(j) ] );
1065 input_bc_mesh->intersect_element_lists(node_list, candidate_list);
1066 for (
auto i_elm : candidate_list) {
1067 if ( input_bc_mesh->element_accessor(i_elm)->dim() == elm.dim() ) result_list.push_back(i_elm);
1070 if (result_list.size() == 1) {
1071 element_ids_map[i] = (
LongIdx)result_list[0];
1076 result_list.clear();
1086 static const double point_tolerance = 1E-10;
1087 if (elm1.
dim() != elm2.
dim())
return false;
1089 for (
unsigned int i=0; i<elm1->
n_nodes(); i++) {
1091 for (
unsigned int j=0; j<elm2->
n_nodes(); j++) {
1092 if ( arma::norm(*elm1.
node(i) - *elm2.
node(j), 1) < point_tolerance)
1095 if (!equal_node)
return false;
1105 std::shared_ptr<std::vector<LongIdx>> map_ptr = std::make_shared<std::vector<LongIdx>>(
element_vec_.size());
1116 unsigned int n_found=0;
1119 for (
auto s : searched_elements) {
1121 if (
equal_elm(elm, acc) ) result_list.push_back(s);
1124 if (result_list.size() == 1) {
1125 element_ids_map[i] = (
LongIdx)result_list[0];
1130 result_list.clear();
1131 searched_elements.clear();
1137 return std::make_shared<std::vector<LongIdx>>(0);
1150 for (
auto elm : bc_mesh->elements_range()) {
1152 for (
auto s : searched_elements) {
1154 if (
equal_elm(elm, acc) ) result_list.push_back(s);
1156 if (result_list.size() == 1) {
1157 element_ids_map[i] = (
LongIdx)result_list[0];
1161 result_list.clear();
1162 searched_elements.clear();
1174 it != region_list.
end();
1213 bih_tree_ = std::make_shared<BIHTree>();
1237 void Mesh::add_element(
unsigned int elm_id,
unsigned int dim,
unsigned int region_id,
unsigned int partition_id,
1249 WarningOut().fmt(
"Bulk elements of zero size(dim=0) are not supported. Element ID: {}.\n", elm_id);
1254 this->
init_element(ele, elm_id, dim, region_idx, partition_id, node_ids);
1262 ele->
init(dim, region_idx);
1263 ele->
pid_ = partition_id;
1265 for (
unsigned int ni=0; ni<ele->
n_nodes(); ni++) {
1275 WarningOut().fmt(
"Tetrahedron element with id {} has wrong numbering or is degenerated (Jacobian = {}).",elm_id, jac);
1333 auto bgn_it = make_iter<Edge>(
Edge(
this, 0) );
1334 auto end_it = make_iter<Edge>(
Edge(
this,
edges.size()) );
1353 ofstream raw_ngh_output_file;
1357 MessageOut() <<
"Opening raw ngh output: " << raw_output_file_path <<
"\n";
1359 raw_output_file_path.
open_stream(raw_ngh_output_file);
1363 if (! raw_ngh_output_file.is_open())
return;
1366 raw_ngh_output_file <<
"// fields:\n//ele_id n_sides ns_side_neighbors[n] neighbors[n*ns] n_vb_neighbors vb_neighbors[n_vb]\n";
1372 unsigned int undefined_ele_id = -1;
1375 if(ele->n_neighs_vb() > 0){
1376 for (
unsigned int i = 0; i < ele->n_neighs_vb(); i++){
1379 auto search = neigh_vb_map.find(higher_ele.
idx());
1380 if(search != neigh_vb_map.end()){
1382 search->second[ele->neigh_vb[i]->side()->side_idx()] = ele.idx();
1387 higher_ele_side_ngh[ele->neigh_vb[i]->side()->side_idx()] = ele.idx();
1388 neigh_vb_map[higher_ele.
idx()] = higher_ele_side_ngh;
1395 raw_ngh_output_file << ele.idx() <<
" ";
1396 raw_ngh_output_file << ele->n_sides() <<
" ";
1398 auto search_neigh = neigh_vb_map.end();
1399 for (
unsigned int i = 0; i < ele->n_sides(); i++) {
1400 unsigned int n_side_neighs = ele.side(i)->edge().n_sides()-1;
1402 if(n_side_neighs == 0){
1404 if(search_neigh == neigh_vb_map.end())
1405 search_neigh = neigh_vb_map.find(ele.idx());
1407 if(search_neigh != neigh_vb_map.end())
1408 if(search_neigh->second[i] != undefined_ele_id)
1411 raw_ngh_output_file << n_side_neighs <<
" ";
1414 for (
unsigned int i = 0; i < ele->n_sides(); i++) {
1423 else if(search_neigh != neigh_vb_map.end()
1424 && search_neigh->second[i] != undefined_ele_id){
1425 raw_ngh_output_file << search_neigh->second[i] <<
" ";
1430 raw_ngh_output_file << ele->n_neighs_vb() <<
" ";
1431 for (
unsigned int i = 0; i < ele->n_neighs_vb(); i++)
1432 raw_ngh_output_file << ele->neigh_vb[i]->side()->element().idx() <<
" ";
1434 raw_ngh_output_file << endl;
1437 raw_ngh_output_file <<
"$EndFlowField\n" << endl;
1446 e_data.partition_id, e_data.node_ids);
1460 std::array<unsigned int, 4> tmp_nodes;
1464 for(
unsigned int i=0; i<elem.
n_nodes(); i++)
1466 tmp_nodes[i] = elem.
nodes_[permutation_vec[i]];
1477 std::array<unsigned int, 4> tmp_nodes;
1481 for(
unsigned int i=0; i<elem.
n_nodes(); i++)
1483 tmp_nodes[i] = elem.
nodes_[permutation_vec[i]];
1496 ASSERT_PTR(
el_4_loc).error(
"Array 'el_4_loc' is not initialized. Did you call Partitioning::id_maps?\n");
1498 unsigned int i_proc, i_node, i_ghost_node, elm_node;
1499 unsigned int my_proc =
el_ds->
myp();
1500 unsigned int n_proc =
el_ds->
np();
1508 i_proc = elm.proc();
1509 for (elm_node=0; elm_node<elm->n_nodes(); elm_node++) {
1510 i_node = elm->node_idx(elm_node);
1511 if (i_proc == my_proc) local_node_flag[i_node] =
true;
1512 if (i_proc < node_proc[i_node]) node_proc[i_node] = i_proc;
1518 for(
uint i_proc : node_proc) {
1519 if (i_proc == my_proc)
1521 else if (i_proc == n_proc)
1522 ASSERT(0)(
find_node_id(n_own_nodes)).error(
"A node does not belong to any element!");
1529 i_ghost_node = n_own_nodes;
1530 for (
unsigned int i=0; i<this->
n_nodes(); ++i) {
1531 if (local_node_flag[i]) {
1532 if (node_proc[i]==my_proc)
Edge edge() const
Returns pointer to the edge connected to the side.
void calculate_node_curve_values_as_hilbert()
unsigned int create_boundary_elements()
Create boundary elements from data of temporary structure, this method MUST be call after read mesh f...
unsigned int np() const
get num of processors
void permute_triangle(unsigned int elm_idx, std::vector< unsigned int > permutation_vec)
Permute nodes of 2D elements of given elm_idx.
static unsigned int permutation_index(unsigned int p[n_nodes_per_side])
Class RefElement defines numbering of vertices, sides, calculation of normal vectors etc.
Armor::Array< double > nodes_
virtual std::shared_ptr< std::vector< LongIdx > > check_compatible_discont_mesh(Mesh &input_mesh)
Mesh * mesh_
Pointer to Mesh to which belonged.
std::vector< int > sort_elements(std::vector< unsigned int > &elem_permutation)
void permute_tetrahedron(unsigned int elm_idx, std::vector< unsigned int > permutation_vec)
Permute nodes of 3D elements of given elm_idx.
std::string label() const
Returns label of the region (using RegionDB)
static const Input::Type::Selection & get_input_intersection_variant()
The definition of input record for selection of variant of file format.
std::vector< BoundingBox > get_element_boxes()
Compute bounding boxes of elements contained in mesh.
unsigned int edge_idx_
Index of Edge in Mesh.
double tetrahedron_jacobian() const
LongIdx * node_4_loc_
Index set assigning to local node index its global index.
void init_element_vector(unsigned int size)
Initialize element_vec_, set size and reset counters of boundary and bulk elements.
static const unsigned int undef_idx
unsigned int elem_idx_
Index of element in Mesh::element_vec_.
void init_element(Element *ele, unsigned int elm_id, unsigned int dim, RegionIdx region_idx, unsigned int partition_id, std::vector< unsigned int > node_ids)
Initialize element.
unsigned int myp() const
get my processor
static Input::Type::Abstract & get_input_type()
void calculate_element_curve_values_as_hilbert_of_centers()
#define ASSERT(expr)
Allow use shorter versions of macro names if these names is not used with external library.
virtual Range< ElementAccessor< 3 > > elements_range() const
Returns range of bulk elements.
unsigned int n_sides() const
Support classes for parallel programing.
unsigned int n_sides() const
Returns number of sides aligned with the edge.
Main class for computation of intersection of meshes of combined dimensions.
bool compare_points(const arma::vec3 &p1, const arma::vec3 &p2)
unsigned int boundary_loaded_size_
Count of boundary elements loaded from mesh file.
ArmaVec< Type, nr > vec(uint mat_index) const
vector< Element > element_vec_
int pid_
Id # of mesh partition.
Dedicated class for storing path to input and output files.
bool is_valid() const
Returns false if the region has undefined/invalid value.
void sort_permuted_nodes_elements(std::vector< int > new_node_ids, std::vector< int > new_elem_ids)
Sort elements and nodes by order stored in permutation vectors.
void mark_used_region(unsigned int idx)
static const Input::Type::Record & get_input_type()
Class for O(log N) lookup for intersections with a set of bounding boxes.
#define THROW(whole_exception_expr)
Wrapper for throw. Saves the throwing point.
friend class RegionSetBase
unsigned int max_edge_sides_[3]
Maximal number of sides per one edge in the actual mesh (set in make_neighbours_and_edges()).
Class for the mesh partitioning. This should provide:
void make_edge_permutations()
#define ASSERT_EQ_DBG(a, b)
Definition of comparative assert macro (EQual) only for debug mode.
Region get_region(unsigned int id, unsigned int dim)
Range< NodeAccessor< 3 > > node_range() const
Returns range of nodes.
const LongIdx * get_loc_part() const
Boundary boundary(uint edge_idx) const
unsigned int idx() const
Returns a global index of the region.
unsigned int n_local_nodes_
Hold number of local nodes (own + ghost), value is equal with size of node_4_loc array.
std::string format(CStringRef format_str, ArgList args)
std::vector< unsigned int > permutation_idx_
const Element * element() const
void open_stream(Stream &stream) const
void read_regions_from_input(Input::Array region_list)
std::string create_label_from_id(unsigned int id) const
MapElementIDToRegionID el_to_reg_map_
IntersectionSearch get_intersection_search()
Getter for input type selection for intersection search algorithm.
bool optimize_memory_locality
unsigned int n_vb_neighbours() const
virtual unsigned int n_elements() const
Returns count of boundary or bulk elements.
#define ASSERT_PTR_DBG(ptr)
Definition of assert macro checking non-null pointer (PTR) only for debug mode.
Distribution * el_ds
Parallel distribution of elements.
unsigned int id() const
Returns id of the region (using RegionDB)
void intersect_element_lists(vector< unsigned int > const &nodes_list, vector< unsigned int > &intersection_element_list)
static const unsigned int undefined_dim
std::vector< int > sort_nodes(std::vector< unsigned int > &node_permutation)
void output_internal_ngh_data()
Output of neighboring data into raw output.
virtual const LongIdx * get_local_part()
BidirectionalMap< int > node_ids_
Maps node ids to indexes into vector node_vec_.
BoundingBox bounding_box() const
void check_mesh_on_read()
void find_point(const Space< 3 >::Point &point, std::vector< unsigned int > &result_list, bool full_list=false) const
bool find_lower_dim_element(vector< unsigned int > &element_list, unsigned int dim, unsigned int &element_idx)
void count_element_types()
const BIHTree & get_bih_tree()
Getter for BIH. Creates and compute BIH at first call.
void distribute_nodes()
Fill array node_4_loc_ and create object node_ds_ according to element distribution.
SideIter side(const unsigned int i) const
Gets side iterator of the i -th side.
BCMesh * get_bc_mesh()
Create boundary mesh if doesn't exist and return it.
bool is_boundary() const
Returns true if it is a Boundary region and false if it is a Bulk region.
LongIdx * el_4_loc
Index set assigning to local element index its global index.
void elements_id_maps(vector< LongIdx > &bulk_elements_id, vector< LongIdx > &boundary_elements_id) const
unsigned int n_neighs_vb_
vector< vector< vector< unsigned int > > > side_nodes
std::vector< unsigned int > node_permutation_
Vector of node permutations of optimized mesh (see class MeshOptimizer)
const unsigned int * get_lsizes_array()
get local sizes array
ElementAccessor< 3 > element()
IntersectionSearch
Types of search algorithm for finding intersection candidates.
int find_elem_id(unsigned int pos) const
Return element id (in GMSH file) of element of given position in element vector.
#define ASSERT_EQ(a, b)
Definition of comparative assert macro (EQual)
void init(unsigned int dim, RegionIdx reg)
Region find_id(unsigned int id, unsigned int dim) const
ElementAccessor< 3 > element() const
Returns iterator to the element of the side.
std::shared_ptr< BIHTree > bih_tree_
Distribution * node_ds_
Parallel distribution of nodes. Depends on elements distribution.
unsigned int n_nodes() const
Returns number of nodes of the side.
NodeAccessor< 3 > node(unsigned int ni) const
bool same_sides(const SideIter &si, vector< unsigned int > &side_nodes)
ArrayMatSet set(uint index)
void element_to_neigh_vb()
unsigned int node_idx(unsigned int ni) const
Return index (in Mesh::node_vec) of ni-th node.
void check_element_size(unsigned int elem_idx) const
Check if given index is in element_vec_.
void add_element(unsigned int elm_id, unsigned int dim, unsigned int region_id, unsigned int partition_id, std::vector< unsigned int > node_ids)
Add new element of given id to mesh.
unsigned int side_idx() const
Returns local index of the side on the element.
static const Input::Type::Record & get_input_type()
Region implicit_boundary_region()
virtual ~Mesh()
Destructor.
std::array< unsigned int, 4 > nodes_
indices to element's nodes
void create_node_element_lists()
unsigned int edge_idx(unsigned int edg_idx) const
Return edge_idx of given index.
int LongIdx
Define type that represents indices of large arrays (elements, nodes, dofs etc.)
Element * add_element_to_vector(int id)
Adds element to mesh data structures (element_vec_, element_ids_), returns pointer to this element.
void modify_element_ids(const RegionDB::MapElementIDToRegionID &map)
bool equal_elm(ElementAccessor< 3 > elm1, ElementAccessor< 3 > elm2)
unsigned int n_sides() const
int elem_index(int elem_id) const
For element of given elem_id returns index in element_vec_ or (-1) if element doesn't exist.
std::vector< EdgeData > edges
Vector of MH edges, this should not be part of the geometrical mesh.
void make_neighbours_and_edges()
void clear()
Clear the content. Do not release memory.
void init_node_vector(unsigned int size)
Initialize node_vec_, set size.
virtual std::shared_ptr< std::vector< LongIdx > > check_compatible_mesh(Mesh &input_mesh)
std::vector< unsigned int > elem_permutation_
Vector of element permutations of optimized mesh (see class MeshOptimizer)
#define WarningOut()
Macro defining 'warning' record of log.
void append(const ArmaMat< Type, nr, nc > &item)
int node_index(int node_id) const
For node of given node_id returns index in element_vec_ or (-1) if node doesn't exist.
Class represents boundary part of mesh.
Range< Edge > edge_range() const
Returns range of edges.
vector< vector< unsigned int > > node_elements_
For each node the vector contains a list of elements that use this node.
#define ASSERT_LT_DBG(a, b)
Definition of comparative assert macro (Less Than) only for debug mode.
BidirectionalMap< int > element_ids_
Maps element ids to indexes into vector element_vec_.
void add_node(unsigned int node_id, arma::vec3 coords)
Add new node of given id and coordinates to mesh.
vector< ElementTmpData > bc_element_tmp_
Hold data of boundary elements during reading mesh (allow to preserve correct order during reading of...
void find_bounding_box(const BoundingBox &boundingBox, std::vector< unsigned int > &result_list, bool full_list=false) const
unsigned int idx() const
Return local idx of element in boundary / bulk part of element vector.
Region add_region(unsigned int id, const std::string &label, unsigned int dim, const std::string &address="implicit")
std::shared_ptr< Partitioning > part_
unsigned int bulk_size_
Count of bulk elements.
unsigned int add_item(T val)
Add new item at the end position of map.
void print_region_table(std::ostream &stream) const
LongIdx * row_4_el
Index set assigning to global element index the local index used in parallel vectors.
const vector< vector< unsigned int > > & node_elements()
double global_snap_radius() const
Maximal distance of observe point from Mesh relative to its size.
vector< BoundaryData > boundary_
unsigned int n_local_nodes() const
virtual Partitioning * get_part()
NodeAccessor< 3 > node(unsigned int i) const
Returns node for given local index i on the side.
BCMesh * bc_mesh_
Boundary mesh, object is created only if it's necessary.
MixedMeshIntersections & mixed_intersections()
#define DebugOut()
Macro defining 'debug' record of log.
#define ASSERT_PTR(ptr)
Definition of assert macro checking non-null pointer (PTR)
SideIter side(const unsigned int loc_index)
NodeAccessor< 3 > node(unsigned int idx) const
Create and return NodeAccessor to node of given idx.
virtual ElementAccessor< 3 > element_accessor(unsigned int idx) const
Create and return ElementAccessor to element of given idx.
void reserve(unsigned int init_size=0)
Reset data of map, reserve space for given size.
virtual unsigned int n_nodes() const
#define START_TIMER(tag)
Starts a timer with specified tag.
int find_node_id(unsigned int pos) const
Return node id (in GMSH file) of node of given position in node vector.
unsigned int * boundary_idx_
Edge edge(uint edge_idx) const
void add_physical_name(unsigned int dim, unsigned int id, std::string name)
Add new node of given id and coordinates to mesh.
vector< Neighbour > vb_neighbours_
#define END_TIMER(tag)
Ends a timer with specified tag.
unsigned int n_nodes() const
unsigned int size() const
Return size of map.
Implementation of range helper class.
#define MessageOut()
Macro defining 'message' record of log.
std::shared_ptr< MixedMeshIntersections > intersections