mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: add faceZone::resetAddressing with constant flipMap
- remove unused static variable, use updated hashtable methods
This commit is contained in:
@ -76,100 +76,102 @@ Description
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
label addPointZone(const polyMesh& mesh, const word& name)
|
||||
label addPointZone(polyMesh& mesh, const word& name)
|
||||
{
|
||||
label zoneID = mesh.pointZones().findZoneID(name);
|
||||
pointZoneMesh& zones = mesh.pointZones();
|
||||
label zoneID = zones.findZoneID(name);
|
||||
|
||||
if (zoneID != -1)
|
||||
{
|
||||
Info<< "Reusing existing pointZone "
|
||||
<< mesh.pointZones()[zoneID].name()
|
||||
Info<< "Reusing existing pointZone " << zones[zoneID].name()
|
||||
<< " at index " << zoneID << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
pointZoneMesh& pointZones = const_cast<polyMesh&>(mesh).pointZones();
|
||||
zoneID = pointZones.size();
|
||||
Info<< "Adding pointZone " << name << " at index " << zoneID << endl;
|
||||
|
||||
pointZones.setSize(zoneID+1);
|
||||
pointZones.set
|
||||
(
|
||||
zoneID,
|
||||
new pointZone
|
||||
(
|
||||
name,
|
||||
labelList(0),
|
||||
zoneID,
|
||||
pointZones
|
||||
)
|
||||
);
|
||||
return zoneID;
|
||||
}
|
||||
|
||||
zoneID = zones.size();
|
||||
Info<< "Adding pointZone " << name << " at index " << zoneID << endl;
|
||||
|
||||
zones.setSize(zoneID+1);
|
||||
zones.set
|
||||
(
|
||||
zoneID,
|
||||
new pointZone
|
||||
(
|
||||
name,
|
||||
labelList(0),
|
||||
zoneID,
|
||||
zones
|
||||
)
|
||||
);
|
||||
|
||||
return zoneID;
|
||||
}
|
||||
|
||||
|
||||
label addFaceZone(const polyMesh& mesh, const word& name)
|
||||
label addFaceZone(polyMesh& mesh, const word& name)
|
||||
{
|
||||
label zoneID = mesh.faceZones().findZoneID(name);
|
||||
faceZoneMesh& zones = mesh.faceZones();
|
||||
label zoneID = zones.findZoneID(name);
|
||||
|
||||
if (zoneID != -1)
|
||||
{
|
||||
Info<< "Reusing existing faceZone " << mesh.faceZones()[zoneID].name()
|
||||
Info<< "Reusing existing faceZone " << zones[zoneID].name()
|
||||
<< " at index " << zoneID << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
faceZoneMesh& faceZones = const_cast<polyMesh&>(mesh).faceZones();
|
||||
zoneID = faceZones.size();
|
||||
Info<< "Adding faceZone " << name << " at index " << zoneID << endl;
|
||||
|
||||
faceZones.setSize(zoneID+1);
|
||||
faceZones.set
|
||||
(
|
||||
zoneID,
|
||||
new faceZone
|
||||
(
|
||||
name,
|
||||
labelList(0),
|
||||
boolList(),
|
||||
zoneID,
|
||||
faceZones
|
||||
)
|
||||
);
|
||||
return zoneID;
|
||||
}
|
||||
|
||||
zoneID = zones.size();
|
||||
Info<< "Adding faceZone " << name << " at index " << zoneID << endl;
|
||||
|
||||
zones.setSize(zoneID+1);
|
||||
zones.set
|
||||
(
|
||||
zoneID,
|
||||
new faceZone
|
||||
(
|
||||
name,
|
||||
labelList(0),
|
||||
boolList(),
|
||||
zoneID,
|
||||
zones
|
||||
)
|
||||
);
|
||||
|
||||
return zoneID;
|
||||
}
|
||||
|
||||
|
||||
label addCellZone(const polyMesh& mesh, const word& name)
|
||||
label addCellZone(polyMesh& mesh, const word& name)
|
||||
{
|
||||
label zoneID = mesh.cellZones().findZoneID(name);
|
||||
cellZoneMesh& zones = mesh.cellZones();
|
||||
label zoneID = zones.findZoneID(name);
|
||||
|
||||
if (zoneID != -1)
|
||||
{
|
||||
Info<< "Reusing existing cellZone " << mesh.cellZones()[zoneID].name()
|
||||
Info<< "Reusing existing cellZone " << zones[zoneID].name()
|
||||
<< " at index " << zoneID << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
cellZoneMesh& cellZones = const_cast<polyMesh&>(mesh).cellZones();
|
||||
zoneID = cellZones.size();
|
||||
Info<< "Adding cellZone " << name << " at index " << zoneID << endl;
|
||||
|
||||
cellZones.setSize(zoneID+1);
|
||||
cellZones.set
|
||||
(
|
||||
zoneID,
|
||||
new cellZone
|
||||
(
|
||||
name,
|
||||
labelList(0),
|
||||
zoneID,
|
||||
cellZones
|
||||
)
|
||||
);
|
||||
return zoneID;
|
||||
}
|
||||
|
||||
zoneID = zones.size();
|
||||
Info<< "Adding cellZone " << name << " at index " << zoneID << endl;
|
||||
|
||||
zones.setSize(zoneID+1);
|
||||
zones.set
|
||||
(
|
||||
zoneID,
|
||||
new cellZone
|
||||
(
|
||||
name,
|
||||
labelList(0),
|
||||
zoneID,
|
||||
zones
|
||||
)
|
||||
);
|
||||
|
||||
return zoneID;
|
||||
}
|
||||
|
||||
@ -340,13 +342,9 @@ int main(int argc, char *argv[])
|
||||
if (perfectCover)
|
||||
{
|
||||
// Add empty zone for resulting internal faces
|
||||
label cutZoneID = addFaceZone(mesh, cutZoneName);
|
||||
const label cutZoneID = addFaceZone(mesh, cutZoneName);
|
||||
|
||||
mesh.faceZones()[cutZoneID].resetAddressing
|
||||
(
|
||||
isf,
|
||||
boolList(masterPatch.size(), false)
|
||||
);
|
||||
mesh.faceZones()[cutZoneID].resetAddressing(isf.xfer(), false);
|
||||
|
||||
// Add the perfect interface mesh modifier
|
||||
stitcher.set
|
||||
@ -370,11 +368,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
label masterZoneID = addFaceZone(mesh, mergePatchName + "MasterZone");
|
||||
|
||||
mesh.faceZones()[masterZoneID].resetAddressing
|
||||
(
|
||||
isf,
|
||||
boolList(masterPatch.size(), false)
|
||||
);
|
||||
mesh.faceZones()[masterZoneID].resetAddressing(isf.xfer(), false);
|
||||
|
||||
// Slave patch
|
||||
const polyPatch& slavePatch = mesh.boundaryMesh()[slavePatchName];
|
||||
@ -387,19 +381,11 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
label slaveZoneID = addFaceZone(mesh, mergePatchName + "SlaveZone");
|
||||
mesh.faceZones()[slaveZoneID].resetAddressing
|
||||
(
|
||||
osf,
|
||||
boolList(slavePatch.size(), false)
|
||||
);
|
||||
mesh.faceZones()[slaveZoneID].resetAddressing(osf.xfer(), false);
|
||||
|
||||
// Add empty zone for cut faces
|
||||
label cutZoneID = addFaceZone(mesh, cutZoneName);
|
||||
mesh.faceZones()[cutZoneID].resetAddressing
|
||||
(
|
||||
labelList(0),
|
||||
boolList(0, false)
|
||||
);
|
||||
const label cutZoneID = addFaceZone(mesh, cutZoneName);
|
||||
mesh.faceZones()[cutZoneID].resetAddressing(labelList(0), false);
|
||||
|
||||
|
||||
// Add the sliding interface mesh modifier
|
||||
|
||||
@ -247,17 +247,7 @@ Foam::label Foam::ZoneMesh<ZoneType, MeshType>::whichZone
|
||||
const label objectIndex
|
||||
) const
|
||||
{
|
||||
const Map<label>& zm = zoneMap();
|
||||
Map<label>::const_iterator zmIter = zm.find(objectIndex);
|
||||
|
||||
if (zmIter == zm.end())
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return zmIter();
|
||||
}
|
||||
return zoneMap().lookup(objectIndex, -1);
|
||||
}
|
||||
|
||||
|
||||
@ -579,13 +569,13 @@ bool Foam::ZoneMesh<ZoneType, MeshType>::checkParallelSync
|
||||
|
||||
|
||||
template<class ZoneType, class MeshType>
|
||||
void Foam::ZoneMesh<ZoneType, MeshType>::movePoints(const pointField& p)
|
||||
void Foam::ZoneMesh<ZoneType, MeshType>::movePoints(const pointField& pts)
|
||||
{
|
||||
PtrList<ZoneType>& zones = *this;
|
||||
|
||||
forAll(zones, zonei)
|
||||
{
|
||||
zones[zonei].movePoints(p);
|
||||
zones[zonei].movePoints(pts);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -176,7 +176,7 @@ public:
|
||||
//- Return zone index for the first match, return -1 if not found
|
||||
label findIndex(const keyType& key) const;
|
||||
|
||||
//- Find zone index given a name
|
||||
//- Find zone index given a name, return -1 if not found
|
||||
label findZoneID(const word& zoneName) const;
|
||||
|
||||
//- Mark cells that match the zone specification
|
||||
@ -191,12 +191,12 @@ public:
|
||||
//- Check zone definition. Return true if in error.
|
||||
bool checkDefinition(const bool report = false) const;
|
||||
|
||||
//- Check whether all procs have all zones and in same order. Return
|
||||
// true if in error.
|
||||
//- Check whether all procs have all zones and in same order.
|
||||
// \return True if any errors.
|
||||
bool checkParallelSync(const bool report = false) const;
|
||||
|
||||
//- Correct zone mesh after moving points
|
||||
void movePoints(const pointField& p);
|
||||
void movePoints(const pointField& pts);
|
||||
|
||||
//- writeData member function required by regIOobject
|
||||
bool writeData(Ostream& os) const;
|
||||
|
||||
@ -33,8 +33,6 @@ Description
|
||||
#include "cellZone.H"
|
||||
#include "cellZoneMeshFwd.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -36,10 +36,10 @@ Description
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
template<class Zone, class MeshType> class ZoneMesh;
|
||||
class cellZone;
|
||||
class polyMesh;
|
||||
|
||||
template<class Zone, class MeshType> class ZoneMesh;
|
||||
typedef ZoneMesh<cellZone, polyMesh> cellZoneMesh;
|
||||
}
|
||||
|
||||
|
||||
@ -33,8 +33,6 @@ Description
|
||||
#include "faceZone.H"
|
||||
#include "faceZoneMeshFwd.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -36,10 +36,10 @@ Description
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
template<class Zone, class MeshType> class ZoneMesh;
|
||||
class faceZone;
|
||||
class polyMesh;
|
||||
|
||||
template<class Zone, class MeshType> class ZoneMesh;
|
||||
typedef ZoneMesh<faceZone, polyMesh> faceZoneMesh;
|
||||
}
|
||||
|
||||
|
||||
@ -33,8 +33,6 @@ Description
|
||||
#include "pointZone.H"
|
||||
#include "pointZoneMeshFwd.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -36,10 +36,10 @@ Description
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
template<class Zone, class MeshType> class ZoneMesh;
|
||||
class pointZone;
|
||||
class polyMesh;
|
||||
|
||||
template<class Zone, class MeshType> class ZoneMesh;
|
||||
typedef ZoneMesh<pointZone, polyMesh> pointZoneMesh;
|
||||
}
|
||||
|
||||
|
||||
@ -42,6 +42,7 @@ namespace Foam
|
||||
|
||||
const char * const Foam::cellZone::labelsName = "cellLabels";
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::cellZone::cellZone
|
||||
|
||||
@ -52,7 +52,7 @@ namespace Foam
|
||||
// Forward declaration of friend functions and operators
|
||||
|
||||
class cellZone;
|
||||
Ostream& operator<<(Ostream&, const cellZone&);
|
||||
Ostream& operator<<(Ostream& os, const cellZone& zn);
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
@ -64,6 +64,12 @@ class cellZone
|
||||
public zone
|
||||
{
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
cellZone(const cellZone&) = delete;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
@ -72,14 +78,6 @@ protected:
|
||||
const cellZoneMesh& zoneMesh_;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
cellZone(const cellZone&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Static data members
|
||||
@ -117,7 +115,7 @@ public:
|
||||
const word& name,
|
||||
const labelUList& addr,
|
||||
const label index,
|
||||
const cellZoneMesh&
|
||||
const cellZoneMesh& zm
|
||||
);
|
||||
|
||||
//- Construct from components, transferring contents
|
||||
@ -126,36 +124,36 @@ public:
|
||||
const word& name,
|
||||
const Xfer<labelList>& addr,
|
||||
const label index,
|
||||
const cellZoneMesh&
|
||||
const cellZoneMesh& zm
|
||||
);
|
||||
|
||||
//- Construct from dictionary
|
||||
cellZone
|
||||
(
|
||||
const word& name,
|
||||
const dictionary&,
|
||||
const dictionary& dict,
|
||||
const label index,
|
||||
const cellZoneMesh&
|
||||
const cellZoneMesh& zm
|
||||
);
|
||||
|
||||
//- Construct given the original zone and resetting the
|
||||
// cell list and zone mesh information
|
||||
//- Construct given the original zone,
|
||||
// resetting the cell list and zone mesh information
|
||||
cellZone
|
||||
(
|
||||
const cellZone&,
|
||||
const cellZone& cz,
|
||||
const labelUList& addr,
|
||||
const label index,
|
||||
const cellZoneMesh&
|
||||
const cellZoneMesh& zm
|
||||
);
|
||||
|
||||
//- Construct given the original zone, resetting the
|
||||
// cell list and zone mesh information
|
||||
//- Construct given the original zone,
|
||||
// resetting the cell list and zone mesh information
|
||||
cellZone
|
||||
(
|
||||
const cellZone&,
|
||||
const cellZone& cz,
|
||||
const Xfer<labelList>& addr,
|
||||
const label index,
|
||||
const cellZoneMesh&
|
||||
const cellZoneMesh& zm
|
||||
);
|
||||
|
||||
//- Construct and return a clone, resetting the zone mesh
|
||||
@ -190,9 +188,9 @@ public:
|
||||
static autoPtr<cellZone> New
|
||||
(
|
||||
const word& name,
|
||||
const dictionary&,
|
||||
const dictionary& dict,
|
||||
const label index,
|
||||
const cellZoneMesh&
|
||||
const cellZoneMesh& zm
|
||||
);
|
||||
|
||||
|
||||
@ -211,33 +209,33 @@ public:
|
||||
//- Check zone definition. Return true if in error.
|
||||
virtual bool checkDefinition(const bool report = false) const;
|
||||
|
||||
//- Check whether zone is synchronised across coupled boundaries. Return
|
||||
// true if in error.
|
||||
//- Check whether zone is synchronised across coupled boundaries.
|
||||
// \return True if any errors.
|
||||
virtual bool checkParallelSync(const bool report = false) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//- Write dictionary
|
||||
virtual void writeDict(Ostream&) const;
|
||||
virtual void writeDict(Ostream& os) const;
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
//- Assign to zone, clearing demand-driven data
|
||||
void operator=(const cellZone&);
|
||||
void operator=(const cellZone& zn);
|
||||
|
||||
//- Assign addressing, clearing demand-driven data
|
||||
void operator=(const labelUList&);
|
||||
void operator=(const labelUList& addr);
|
||||
|
||||
//- Assign addressing, clearing demand-driven data
|
||||
void operator=(const Xfer<labelList>&);
|
||||
void operator=(const Xfer<labelList>& addr);
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
//- Ostream Operator
|
||||
friend Ostream& operator<<(Ostream&, const cellZone&);
|
||||
friend Ostream& operator<<(Ostream& os, const cellZone& zn);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -43,6 +43,23 @@ namespace Foam
|
||||
|
||||
const char* const Foam::faceZone::labelsName = "faceLabels";
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::faceZone::setFlipMap(const bool flipValue)
|
||||
{
|
||||
// Match size for flipMap
|
||||
if (flipMap_.size() == this->size())
|
||||
{
|
||||
flipMap_ = flipValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Avoid copying old values on resize
|
||||
flipMap_.clear();
|
||||
flipMap_.setSize(this->size(), flipValue);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
@ -128,8 +145,8 @@ void Foam::faceZone::calcCellLayers() const
|
||||
|
||||
forAll(mf, facei)
|
||||
{
|
||||
label ownCelli = own[mf[facei]];
|
||||
label neiCelli =
|
||||
const label ownCelli = own[mf[facei]];
|
||||
const label neiCelli =
|
||||
(
|
||||
zoneMesh().mesh().isInternalFace(mf[facei])
|
||||
? nei[mf[facei]]
|
||||
@ -386,6 +403,30 @@ void Foam::faceZone::resetAddressing
|
||||
}
|
||||
|
||||
|
||||
void Foam::faceZone::resetAddressing
|
||||
(
|
||||
const labelUList& addr,
|
||||
const bool flipValue
|
||||
)
|
||||
{
|
||||
clearAddressing();
|
||||
labelList::operator=(addr);
|
||||
setFlipMap(flipValue);
|
||||
}
|
||||
|
||||
|
||||
void Foam::faceZone::resetAddressing
|
||||
(
|
||||
const Xfer<labelList>& addr,
|
||||
const bool flipValue
|
||||
)
|
||||
{
|
||||
clearAddressing();
|
||||
labelList::operator=(addr);
|
||||
setFlipMap(flipValue);
|
||||
}
|
||||
|
||||
|
||||
void Foam::faceZone::updateMesh(const mapPolyMesh& mpm)
|
||||
{
|
||||
clearAddressing();
|
||||
@ -511,11 +552,11 @@ bool Foam::faceZone::checkParallelSync(const bool report) const
|
||||
}
|
||||
|
||||
|
||||
void Foam::faceZone::movePoints(const pointField& p)
|
||||
void Foam::faceZone::movePoints(const pointField& pts)
|
||||
{
|
||||
if (patchPtr_)
|
||||
{
|
||||
patchPtr_->movePoints(p);
|
||||
patchPtr_->movePoints(pts);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -55,7 +55,7 @@ class mapPolyMesh;
|
||||
// Forward declaration of friend functions and operators
|
||||
|
||||
class faceZone;
|
||||
Ostream& operator<<(Ostream&, const faceZone&);
|
||||
Ostream& operator<<(Ostream& os, const faceZone& zn);
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
@ -66,46 +66,43 @@ class faceZone
|
||||
:
|
||||
public zone
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- The name associated with the zone-labels dictionary entry
|
||||
static const word labelsName_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Set flip-map to constant value
|
||||
void setFlipMap(const bool flipValue);
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
faceZone(const faceZone&);
|
||||
faceZone(const faceZone&) = delete;
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const faceZone&);
|
||||
void operator=(const faceZone&) = delete;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Flip map for all faces in the zone. Set to true if the
|
||||
// face needs to be flipped to achieve the correct orientation.
|
||||
//- Flip map for all faces in the zone.
|
||||
// Use true if the face needs flipping for the correct orientation.
|
||||
boolList flipMap_;
|
||||
|
||||
//- Reference to zone list
|
||||
const faceZoneMesh& zoneMesh_;
|
||||
|
||||
|
||||
// Demand-driven private data
|
||||
// Demand-driven data
|
||||
|
||||
//- Primitive patch made out of correctly flipped faces
|
||||
mutable primitiveFacePatch* patchPtr_;
|
||||
//- Primitive patch made out of correctly flipped faces
|
||||
mutable primitiveFacePatch* patchPtr_;
|
||||
|
||||
//- Master cell layer
|
||||
mutable labelList* masterCellsPtr_;
|
||||
//- Master cell layer
|
||||
mutable labelList* masterCellsPtr_;
|
||||
|
||||
//- Slave cell layer
|
||||
mutable labelList* slaveCellsPtr_;
|
||||
//- Slave cell layer
|
||||
mutable labelList* slaveCellsPtr_;
|
||||
|
||||
//- Global edge addressing
|
||||
mutable labelList* mePtr_;
|
||||
//- Global edge addressing
|
||||
mutable labelList* mePtr_;
|
||||
|
||||
|
||||
// Protected Member Functions
|
||||
@ -168,38 +165,38 @@ public:
|
||||
const Xfer<labelList>& addr,
|
||||
const Xfer<boolList>& fm,
|
||||
const label index,
|
||||
const faceZoneMesh&
|
||||
const faceZoneMesh& zm
|
||||
);
|
||||
|
||||
//- Construct from dictionary
|
||||
faceZone
|
||||
(
|
||||
const word& name,
|
||||
const dictionary&,
|
||||
const dictionary& dict,
|
||||
const label index,
|
||||
const faceZoneMesh&
|
||||
const faceZoneMesh& zm
|
||||
);
|
||||
|
||||
//- Construct given the original zone and resetting the
|
||||
// face list and zone mesh information
|
||||
faceZone
|
||||
(
|
||||
const faceZone&,
|
||||
const faceZone& fz,
|
||||
const labelUList& addr,
|
||||
const boolList& fm,
|
||||
const label index,
|
||||
const faceZoneMesh&
|
||||
const faceZoneMesh& zm
|
||||
);
|
||||
|
||||
//- Construct given the original zone, resetting the
|
||||
// face list and zone mesh information
|
||||
//- Construct given the original zone,
|
||||
// resetting the face list and zone mesh information
|
||||
faceZone
|
||||
(
|
||||
const faceZone&,
|
||||
const faceZone& fz,
|
||||
const Xfer<labelList>& addr,
|
||||
const Xfer<boolList>& fm,
|
||||
const label index,
|
||||
const faceZoneMesh&
|
||||
const faceZoneMesh& zm
|
||||
);
|
||||
|
||||
//- Construct and return a clone, resetting the zone mesh
|
||||
@ -235,9 +232,9 @@ public:
|
||||
static autoPtr<faceZone> New
|
||||
(
|
||||
const word& name,
|
||||
const dictionary&,
|
||||
const dictionary& dict,
|
||||
const label index,
|
||||
const faceZoneMesh&
|
||||
const faceZoneMesh& zm
|
||||
);
|
||||
|
||||
|
||||
@ -247,6 +244,9 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return zoneMesh reference
|
||||
const faceZoneMesh& zoneMesh() const;
|
||||
|
||||
//- Return face flip map
|
||||
const boolList& flipMap() const
|
||||
{
|
||||
@ -259,52 +259,71 @@ public:
|
||||
//- Return reference to primitive patch
|
||||
const primitiveFacePatch& operator()() const;
|
||||
|
||||
//- Return zoneMesh reference
|
||||
const faceZoneMesh& zoneMesh() const;
|
||||
|
||||
// Addressing into mesh
|
||||
|
||||
// Addressing into mesh
|
||||
//- Return labels of master cells (cells next to the master face
|
||||
// zone in the prescribed direction)
|
||||
const labelList& masterCells() const;
|
||||
|
||||
//- Return labels of master cells (cells next to the master face
|
||||
// zone in the prescribed direction)
|
||||
const labelList& masterCells() const;
|
||||
//- Return labels of slave cells
|
||||
const labelList& slaveCells() const;
|
||||
|
||||
//- Return labels of slave cells
|
||||
const labelList& slaveCells() const;
|
||||
|
||||
//- Return global edge index for local edges
|
||||
const labelList& meshEdges() const;
|
||||
//- Return global edge index for local edges
|
||||
const labelList& meshEdges() const;
|
||||
|
||||
|
||||
//- Clear addressing
|
||||
virtual void clearAddressing();
|
||||
|
||||
//- Reset addressing and flip map (clearing demand-driven data)
|
||||
virtual void resetAddressing(const labelUList&, const boolList&);
|
||||
//- Reset addressing and flip map.
|
||||
// Clears demand-driven data.
|
||||
virtual void resetAddressing
|
||||
(
|
||||
const labelUList& addr,
|
||||
const boolList& flipMap
|
||||
);
|
||||
|
||||
//- Reset addressing - use constant flip map
|
||||
// Clears demand-driven data.
|
||||
virtual void resetAddressing
|
||||
(
|
||||
const labelUList& addr,
|
||||
const bool flipValue
|
||||
);
|
||||
|
||||
//- Reset addressing - use constant flip map
|
||||
// Clears demand-driven data.
|
||||
virtual void resetAddressing
|
||||
(
|
||||
const Xfer<labelList>& addr,
|
||||
const bool flipValue
|
||||
);
|
||||
|
||||
//- Check zone definition. Return true if in error.
|
||||
virtual bool checkDefinition(const bool report = false) const;
|
||||
|
||||
//- Check whether all procs have faces synchronised. Return
|
||||
// true if in error.
|
||||
//- Check whether all procs have faces synchronised.
|
||||
// \return True if any errors.
|
||||
virtual bool checkParallelSync(const bool report = false) const;
|
||||
|
||||
//- Correct patch after moving points
|
||||
virtual void movePoints(const pointField&);
|
||||
virtual void movePoints(const pointField& pts);
|
||||
|
||||
//- Update for changes in topology
|
||||
virtual void updateMesh(const mapPolyMesh&);
|
||||
virtual void updateMesh(const mapPolyMesh& mpm);
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
virtual void write(Ostream& os) const;
|
||||
|
||||
//- Write dictionary
|
||||
virtual void writeDict(Ostream&) const;
|
||||
virtual void writeDict(Ostream& os) const;
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
//- Ostream Operator
|
||||
friend Ostream& operator<<(Ostream&, const faceZone&);
|
||||
friend Ostream& operator<<(Ostream& os, const faceZone& zn);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -42,6 +42,7 @@ namespace Foam
|
||||
|
||||
const char* const Foam::pointZone::labelsName = "pointLabels";
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::pointZone::pointZone
|
||||
|
||||
@ -53,7 +53,7 @@ namespace Foam
|
||||
// Forward declaration of friend functions and operators
|
||||
|
||||
class pointZone;
|
||||
Ostream& operator<<(Ostream&, const pointZone&);
|
||||
Ostream& operator<<(Ostream& os, const pointZone& zn);
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
@ -64,6 +64,11 @@ class pointZone
|
||||
:
|
||||
public zone
|
||||
{
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
pointZone(const pointZone&) = delete;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
@ -72,10 +77,6 @@ protected:
|
||||
//- Reference to zone list
|
||||
const pointZoneMesh& zoneMesh_;
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
pointZone(const pointZone&);
|
||||
|
||||
public:
|
||||
|
||||
@ -114,7 +115,7 @@ public:
|
||||
const word& name,
|
||||
const labelUList& addr,
|
||||
const label index,
|
||||
const pointZoneMesh&
|
||||
const pointZoneMesh& zm
|
||||
);
|
||||
|
||||
//- Construct from components, transferring contents
|
||||
@ -123,36 +124,36 @@ public:
|
||||
const word& name,
|
||||
const Xfer<labelList>& addr,
|
||||
const label index,
|
||||
const pointZoneMesh&
|
||||
const pointZoneMesh& zm
|
||||
);
|
||||
|
||||
//- Construct from dictionary
|
||||
pointZone
|
||||
(
|
||||
const word& name,
|
||||
const dictionary&,
|
||||
const dictionary& dict,
|
||||
const label index,
|
||||
const pointZoneMesh&
|
||||
const pointZoneMesh& zm
|
||||
);
|
||||
|
||||
//- Construct given the original zone and resetting the
|
||||
// point list and zone mesh information
|
||||
pointZone
|
||||
(
|
||||
const pointZone&,
|
||||
const pointZone& pz,
|
||||
const labelUList& addr,
|
||||
const label index,
|
||||
const pointZoneMesh&
|
||||
const pointZoneMesh& zm
|
||||
);
|
||||
|
||||
//- Construct given the original zone, resetting the
|
||||
// face list and zone mesh information
|
||||
//- Construct given the original zone,
|
||||
// resetting the point list and zone mesh information
|
||||
pointZone
|
||||
(
|
||||
const pointZone&,
|
||||
const pointZone& pz,
|
||||
const Xfer<labelList>& addr,
|
||||
const label index,
|
||||
const pointZoneMesh&
|
||||
const pointZoneMesh& zm
|
||||
);
|
||||
|
||||
//- Construct and return a clone, resetting the zone mesh
|
||||
@ -187,9 +188,9 @@ public:
|
||||
static autoPtr<pointZone> New
|
||||
(
|
||||
const word& name,
|
||||
const dictionary&,
|
||||
const dictionary& dict,
|
||||
const label index,
|
||||
const pointZoneMesh&
|
||||
const pointZoneMesh& zm
|
||||
);
|
||||
|
||||
|
||||
@ -208,8 +209,8 @@ public:
|
||||
//- Check zone definition. Return true if in error.
|
||||
virtual bool checkDefinition(const bool report = false) const;
|
||||
|
||||
//- Check whether zone is synchronised across coupled boundaries. Return
|
||||
// true if in error.
|
||||
//- Check whether zone is synchronised across coupled boundaries.
|
||||
// \return True if any errors.
|
||||
virtual bool checkParallelSync(const bool report = false) const;
|
||||
|
||||
//- Correct patch after moving points
|
||||
@ -217,25 +218,25 @@ public:
|
||||
{}
|
||||
|
||||
//- Write dictionary
|
||||
virtual void writeDict(Ostream&) const;
|
||||
virtual void writeDict(Ostream& os) const;
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
//- Assign to zone, clearing demand-driven data
|
||||
void operator=(const pointZone&);
|
||||
void operator=(const pointZone& zn);
|
||||
|
||||
//- Assign addressing, clearing demand-driven data
|
||||
void operator=(const labelUList&);
|
||||
void operator=(const labelUList& addr);
|
||||
|
||||
//- Assign addressing, clearing demand-driven data
|
||||
void operator=(const Xfer<labelList>&);
|
||||
void operator=(const Xfer<labelList>& addr);
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
//- Ostream Operator
|
||||
friend Ostream& operator<<(Ostream&, const pointZone&);
|
||||
friend Ostream& operator<<(Ostream& os, const pointZone& zn);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -127,13 +127,13 @@ Foam::zone::zone
|
||||
|
||||
Foam::zone::zone
|
||||
(
|
||||
const zone& z,
|
||||
const zone& zn,
|
||||
const labelUList& addr,
|
||||
const label index
|
||||
)
|
||||
:
|
||||
labelList(addr),
|
||||
name_(z.name()),
|
||||
name_(zn.name()),
|
||||
index_(index),
|
||||
lookupMapPtr_(nullptr)
|
||||
{}
|
||||
@ -141,13 +141,13 @@ Foam::zone::zone
|
||||
|
||||
Foam::zone::zone
|
||||
(
|
||||
const zone& z,
|
||||
const zone& zn,
|
||||
const Xfer<labelList>& addr,
|
||||
const label index
|
||||
)
|
||||
:
|
||||
labelList(addr),
|
||||
name_(z.name()),
|
||||
name_(zn.name()),
|
||||
index_(index),
|
||||
lookupMapPtr_(nullptr)
|
||||
{}
|
||||
@ -165,18 +165,7 @@ Foam::zone::~zone()
|
||||
|
||||
Foam::label Foam::zone::localID(const label globalCellID) const
|
||||
{
|
||||
const Map<label>& lm = lookupMap();
|
||||
|
||||
Map<label>::const_iterator lmIter = lm.find(globalCellID);
|
||||
|
||||
if (lmIter == lm.end())
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return lmIter();
|
||||
}
|
||||
return lookupMap().lookup(globalCellID, -1);
|
||||
}
|
||||
|
||||
|
||||
@ -197,7 +186,8 @@ bool Foam::zone::checkDefinition(const label maxSize, const bool report) const
|
||||
|
||||
forAll(addr, i)
|
||||
{
|
||||
if (addr[i] < 0 || addr[i] >= maxSize)
|
||||
const label idx = addr[i];
|
||||
if (idx < 0 || idx >= maxSize)
|
||||
{
|
||||
hasError = true;
|
||||
|
||||
@ -205,7 +195,7 @@ bool Foam::zone::checkDefinition(const label maxSize, const bool report) const
|
||||
{
|
||||
SeriousErrorInFunction
|
||||
<< "Zone " << name_
|
||||
<< " contains invalid index label " << addr[i] << nl
|
||||
<< " contains invalid index label " << idx << nl
|
||||
<< "Valid index labels are 0.."
|
||||
<< maxSize-1 << endl;
|
||||
}
|
||||
@ -215,13 +205,13 @@ bool Foam::zone::checkDefinition(const label maxSize, const bool report) const
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (!elems.insert(addr[i]))
|
||||
else if (!elems.insert(idx))
|
||||
{
|
||||
if (report)
|
||||
{
|
||||
WarningInFunction
|
||||
<< "Zone " << name_
|
||||
<< " contains duplicate index label " << addr[i] << endl;
|
||||
<< " contains duplicate index label " << idx << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -239,9 +229,9 @@ void Foam::zone::write(Ostream& os) const
|
||||
|
||||
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
|
||||
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const zone& z)
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const zone& zn)
|
||||
{
|
||||
z.write(os);
|
||||
zn.write(os);
|
||||
os.check(FUNCTION_NAME);
|
||||
return os;
|
||||
}
|
||||
|
||||
@ -49,7 +49,7 @@ namespace Foam
|
||||
// Forward declaration of friend functions and operators
|
||||
|
||||
class zone;
|
||||
Ostream& operator<<(Ostream&, const zone&);
|
||||
Ostream& operator<<(Ostream& os, const zone& zn);
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class zone Declaration
|
||||
@ -59,6 +59,11 @@ class zone
|
||||
:
|
||||
public labelList
|
||||
{
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
zone(const zone&) = delete;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
@ -71,10 +76,10 @@ protected:
|
||||
label index_;
|
||||
|
||||
|
||||
// Demand-driven private data
|
||||
// Demand-driven private data
|
||||
|
||||
//- Map of labels in zone for fast location lookup
|
||||
mutable Map<label>* lookupMapPtr_;
|
||||
//- Map of labels in zone for fast location lookup
|
||||
mutable Map<label>* lookupMapPtr_;
|
||||
|
||||
|
||||
// Protected Member Functions
|
||||
@ -82,9 +87,6 @@ protected:
|
||||
//- Construct the look-up map
|
||||
void calcLookupMap() const;
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
zone(const zone&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -114,7 +116,7 @@ public:
|
||||
zone
|
||||
(
|
||||
const word& name,
|
||||
const dictionary&,
|
||||
const dictionary& dict,
|
||||
const word& labelsName,
|
||||
const label index
|
||||
);
|
||||
@ -123,7 +125,7 @@ public:
|
||||
// cell list and zone mesh information
|
||||
zone
|
||||
(
|
||||
const zone&,
|
||||
const zone& zn,
|
||||
const labelUList& addr,
|
||||
const label index
|
||||
);
|
||||
@ -132,7 +134,7 @@ public:
|
||||
// cell list and zone mesh information
|
||||
zone
|
||||
(
|
||||
const zone&,
|
||||
const zone& zn,
|
||||
const Xfer<labelList>& addr,
|
||||
const label index
|
||||
);
|
||||
@ -178,20 +180,20 @@ public:
|
||||
) const;
|
||||
|
||||
//- Correct patch after moving points
|
||||
virtual void movePoints(const pointField&)
|
||||
virtual void movePoints(const pointField& pts)
|
||||
{}
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
virtual void write(Ostream& os) const;
|
||||
|
||||
//- Write dictionary
|
||||
virtual void writeDict(Ostream&) const = 0;
|
||||
virtual void writeDict(Ostream& os) const = 0;
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
//- Ostream Operator
|
||||
friend Ostream& operator<<(Ostream&, const zone&);
|
||||
friend Ostream& operator<<(Ostream& os, const zone& zn);
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user