LifeV
Utilities

Some general Utilities on MeshEntityContainer. More...

Functions

template<typename EntityContainer >
void reorderAccordingToIdPermutation (EntityContainer &container, std::vector< ID > const &newToOld)
 Reorder according to a permutation vector. More...
 
template<typename EntityContainer , typename RefEntityContainer >
void fixAfterPermutation (EntityContainer &container, RefEntityContainer const &refcontainer, std::vector< ID > const &newToOld)
 Fix pointers after permutation If a mesh entity contains pointers to other mesh entities (typically Points), after the renumbering of the referenced mesh entity (for instance using reorderAccordingToPermutation on Points) the address stored in the pointers will be wrong since it refers to the old numbering! This routine fixes it. More...
 
template<typename EntityContainer , typename PointContainer >
void fixAfterShallowCopy (EntityContainer &container, PointContainer const &newPointContainer)
 ! Fix pointers after shallow copy More...
 

Detailed Description

Some general Utilities on MeshEntityContainer.

Function Documentation

◆ reorderAccordingToIdPermutation()

void LifeV::Utilities::reorderAccordingToIdPermutation ( EntityContainer &  container,
std::vector< ID > const &  newToOld 
)

Reorder according to a permutation vector.

We can reorder a MeshEntityContainer by passing a permutation vector std::vector<ID> newToOld;

The entity originally in position newtoold[id] will be moved to position id All ids (local id!) will be renumbered to reflect the new position in the container.

Precondition
The permutation vector must be of the right size
The permutation vector must be a good permutation vector

Definition at line 539 of file MeshEntityContainer.hpp.

◆ fixAfterPermutation()

void LifeV::Utilities::fixAfterPermutation ( EntityContainer &  container,
RefEntityContainer const &  refcontainer,
std::vector< ID > const &  newToOld 
)

Fix pointers after permutation If a mesh entity contains pointers to other mesh entities (typically Points), after the renumbering of the referenced mesh entity (for instance using reorderAccordingToPermutation on Points) the address stored in the pointers will be wrong since it refers to the old numbering! This routine fixes it.

It has to be called AFTER the reordering of the references mesh entities (i.e. the points) and NOT before.

Example:

reorderAccordingToIdPermutation(mesh.points(),newToOld);
// Now all entities storing pointers to points are invalid!!
fixAfterPermutation(mesh.faces(),mesh.points(),newToOld);
//FIxed!

Definition at line 572 of file MeshEntityContainer.hpp.

◆ fixAfterShallowCopy()

void LifeV::Utilities::fixAfterShallowCopy ( EntityContainer &  container,
PointContainer const &  newPointContainer 
)

! Fix pointers after shallow copy

If a mesh entity contains pointers to other mesh entities (typically Points), after a shallow copy, for instance by the automatic copy constructor, the pointers may still refer to a wrong list of Points! This utility allows to change the situation and make the pointers to point to the new list of Points. By this utility the deep copy of a RegionMesh is now possible!

Example:

PointList newPoints(mesh.pointList); // deep copy since list stores Point(s)
FaceList newFaces(mesh.faceList); // This is a shallow copy since we store Point*
fixAfterShallowCopy(newFaces,newPoints); now the pointers point to newPoint
Parameters
containerthe entity container with the wrong pointers to Point
newPointContainerthe container with the list new Points
Precondition
container must contain pointers to valid points
Note
For efficiency reason no consistency checks are made

Definition at line 616 of file MeshEntityContainer.hpp.