33 void Foam::faAreaMapper::calcAddressing()
const 38 || newFaceLabelsMapPtr_
42 || insertedObjectsPtr_
46 <<
"Addressing already calculated" 63 newFaceLabelsPtr_ = std::make_unique<labelList>
65 mesh_.
mesh().nBoundaryFaces(),
70 newFaceLabelsMapPtr_ = std::make_unique<labelList>
72 mesh_.
mesh().nBoundaryFaces(),
78 Info<<
"Old face list size: " << oldFaces.size()
87 if (reverseFaceMap[oldFaces[faceI]] > -1)
104 directAddrPtr_ = std::make_unique<labelList>
108 auto& addr = *directAddrPtr_;
113 if (addr[facei] < oldNInternal)
123 interpAddrPtr_ = std::make_unique<labelListList>
127 auto& addr = *interpAddrPtr_;
129 weightsPtr_ = std::make_unique<scalarListList>(addr.size());
130 auto& wght = *weightsPtr_;
133 for (label addrI = 0; addrI < nNewFaces; ++addrI)
136 wght[addrI].resize(1, 1.0);
147 DynamicList<label> validMo(128);
149 const auto addCheckedObjects = [&](
const List<objectMap>& maps)
151 for (
const objectMap& map : maps)
154 const label facei = map.index();
155 const labelList& mo = map.masterObjects();
156 if (mo.empty())
continue;
159 validMo.reserve(mo.size());
161 for (
const label obji : mo)
163 if (oldFaceLookup.contains(obji))
165 validMo.push_back(obji);
178 addr[nNewFaces] = validMo;
180 scalarList(validMo.size(), 1.0/validMo.size());
200 addr.resize(nNewFaces);
201 wght.resize(nNewFaces);
203 Info<<
"addr: " << addr <<
nl 204 <<
"wght: " << wght <<
endl;
209 insertedObjectsPtr_ = std::make_unique<labelList>();
237 sizeBeforeMapping_(
mesh.nFaces()),
241 mpm.facesFromPointsMap().empty()
242 && mpm.facesFromEdgesMap().empty()
243 && mpm.facesFromFacesMap().empty()
261 if (!newFaceLabelsPtr_)
266 return *newFaceLabelsPtr_;
272 if (!newFaceLabelsMapPtr_)
277 return *newFaceLabelsMapPtr_;
286 <<
"Requested direct addressing for an interpolative mapper." 295 return *directAddrPtr_;
304 <<
"Requested interpolative addressing for a direct mapper." 313 return *interpAddrPtr_;
322 <<
"Requested interpolative weights for a direct mapper." 337 if (!insertedObjectsPtr_)
342 return *insertedObjectsPtr_;
List< scalar > scalarList
List of scalar.
Finite area mesh (used for 2-D non-Euclidian finite area method) defined using a patch of faces on a ...
void size(const label n)
Older name for setAddressableSize.
virtual ~faAreaMapper()
Destructor.
void resize(const label len)
Adjust allocated size of list.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const labelList & newFaceLabels() const
Return new face labels.
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
const labelList & newFaceLabelsMap() const
Return new face labels map.
SubList< label > subList
Declare type of subList.
const List< objectMap > & facesFromPointsMap() const noexcept
Faces inflated from points.
static const faMesh & mesh(const polyMesh &pMesh)
The single-region finite-area region on the polyMesh. Uses lookupObject semantics - Fatal if non-exis...
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
virtual const labelList & insertedObjectLabels() const
Return list of inserted faces.
label nOldInternalFaces() const
Number of old internal faces.
faAreaMapper(const faAreaMapper &)=delete
No copy construct.
#define forAll(list, i)
Loop across all elements in list.
const labelList & reverseFaceMap() const noexcept
Reverse face map.
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
const labelList & faceLabels() const noexcept
Return the underlying polyMesh face labels.
void clear()
Clear the list, i.e. set size to zero.
errorManip< error > abort(error &err)
const List< objectMap > & facesFromEdgesMap() const noexcept
Faces inflated from edges.
virtual bool direct() const
Is the mapping direct.
messageStream Info
Information stream (stdout output on master, null elsewhere)
virtual const scalarListList & weights() const
Return interpolation weights.
List< label > labelList
A List of labels.
const List< objectMap > & facesFromFacesMap() const noexcept
Faces originating from faces.
virtual const labelUList & directAddressing() const
Return direct addressing.
virtual const labelListList & addressing() const
Return interpolated addressing.