Skip to content
Merged
96 changes: 46 additions & 50 deletions include/mesh/mesh_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,7 @@ class MeshBase : public ParallelObject
* the preparation done in a call to \p prepare_for_use, \p false
* otherwise.
*/
bool is_prepared () const
{ return _preparation; }
bool is_prepared () const;

/**
* \returns the \p Preparation structure with details about in what
Expand Down Expand Up @@ -1358,6 +1357,13 @@ class MeshBase : public ParallelObject
void allow_find_neighbors(bool allow) { _skip_find_neighbors = !allow; }
bool allow_find_neighbors() const { return !_skip_find_neighbors; }

/**
* If \p false is passed then this mesh will no longer work to detect
* interior parents when being prepared for use
*/
void allow_detect_interior_parents(bool allow) { _skip_detect_interior_parents = !allow; }
bool allow_detect_interior_parents() const { return !_skip_detect_interior_parents; }

/**
* If false is passed in then this mesh will no longer have remote
* elements deleted when being prepared for use; i.e. even a
Expand Down Expand Up @@ -1555,7 +1561,8 @@ class MeshBase : public ParallelObject
virtual void read (const std::string & name,
void * mesh_data=nullptr,
bool skip_renumber_nodes_and_elements=false,
bool skip_find_neighbors=false) = 0;
bool skip_find_neighbors=false,
bool skip_detect_interior_parents=false) = 0;
virtual void write (const std::string & name) const = 0;

/**
Expand Down Expand Up @@ -2014,53 +2021,37 @@ class MeshBase : public ParallelObject
*/
struct Preparation
{
bool is_partitioned = false,
has_synched_id_counts = false,
has_neighbor_ptrs = false,
has_cached_elem_data = false,
has_interior_parent_ptrs = false,
has_removed_remote_elements = false,
has_removed_orphaned_nodes = false,
has_boundary_id_sets = false,
has_reinit_ghosting_functors = false;

operator bool() const {
return is_partitioned &&
has_synched_id_counts &&
has_neighbor_ptrs &&
has_cached_elem_data &&
has_interior_parent_ptrs &&
has_removed_remote_elements &&
has_removed_orphaned_nodes &&
has_reinit_ghosting_functors &&
has_boundary_id_sets;
}

Preparation & operator= (bool set_all) {
is_partitioned = set_all;
has_synched_id_counts = set_all;
has_neighbor_ptrs = set_all;
has_cached_elem_data = set_all;
has_interior_parent_ptrs = set_all;
has_removed_remote_elements = set_all;
has_removed_orphaned_nodes = set_all;
has_reinit_ghosting_functors = set_all;
has_boundary_id_sets = set_all;

return *this;
}

bool operator== (const Preparation & other) {
return is_partitioned == other.is_partitioned &&
has_synched_id_counts == other.has_synched_id_counts &&
has_neighbor_ptrs == other.has_neighbor_ptrs &&
has_cached_elem_data == other.has_cached_elem_data &&
has_interior_parent_ptrs == other.has_interior_parent_ptrs &&
has_removed_remote_elements == other.has_removed_remote_elements &&
has_removed_orphaned_nodes == other.has_removed_orphaned_nodes &&
has_reinit_ghosting_functors == other.has_reinit_ghosting_functors &&
has_boundary_id_sets == other.has_boundary_id_sets;
}
/**
* Constructor. Initializes all flags to false.
*/
Preparation();

/**
* Returns true iff all the flags are true.
*/
explicit operator bool() const;

/**
* Set all flags to the "set_all" value.
*/
Preparation & operator= (bool set_all);

/**
* Two Preparation objects are equivalent iff all the flags match,
* regardless of the true/false status of any given flag.
*/
bool operator== (const Preparation & other) const;
bool operator!= (const Preparation & other) const;

bool is_partitioned;
bool has_synched_id_counts;
bool has_neighbor_ptrs;
bool has_cached_elem_data;
bool has_interior_parent_ptrs;
bool has_removed_remote_elements;
bool has_removed_orphaned_nodes;
bool has_boundary_id_sets;
bool has_reinit_ghosting_functors;
};

protected:
Expand Down Expand Up @@ -2204,6 +2195,11 @@ class MeshBase : public ParallelObject
*/
bool _skip_find_neighbors;

/**
* If this is \p true then we will skip \p detect_interior_parents in \p prepare_for_use
*/
bool _skip_detect_interior_parents;

/**
* If this is false then even on DistributedMesh remote elements
* will not be deleted during mesh preparation.
Expand Down
3 changes: 2 additions & 1 deletion include/mesh/unstructured_mesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ class UnstructuredMesh : public MeshBase
virtual void read (const std::string & name,
void * mesh_data=nullptr,
bool skip_renumber_nodes_and_elements=false,
bool skip_find_neighbors=false) override;
bool skip_find_neighbors=false,
bool skip_detect_interior_parents=false) override;
/**
* Write the file specified by \p name. Attempts to figure out the
* proper method by the file extension.
Expand Down
1 change: 1 addition & 0 deletions src/mesh/distributed_mesh.C
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ DistributedMesh::DistributedMesh (const MeshBase & other_mesh) :
this->copy_nodes_and_elements(other_mesh, true, 0, 0, 0, nullptr, true);

this->allow_find_neighbors(other_mesh.allow_find_neighbors());
this->allow_detect_interior_parents(other_mesh.allow_detect_interior_parents());
this->allow_renumbering(other_mesh.allow_renumbering());
this->allow_remote_element_removal(other_mesh.allow_remote_element_removal());
this->skip_partitioning(other_mesh.skip_partitioning());
Expand Down
Loading