86 scalar threshold = tolerance_*src_.cellVolumes()[srcCelli];
93 treeBoundBox bbTgtCell(tgt_.points(), tgt_.faces()[cellFaces[0]]);
94 for (label i = 1; i < cellFaces.
size(); ++i)
96 bbTgtCell.
add(tgt_.points(), tgt_.faces()[cellFaces[i]]);
99 return overlapEngine.cellCellOverlapMinDecomp
113 const label srcCelli,
122 treeBoundBox bbTgtCell(tgt_.points(), tgt_.faces()[cellFaces[0]]);
123 for (label i = 1; i < cellFaces.
size(); ++i)
125 bbTgtCell.
add(tgt_.points(), tgt_.faces()[cellFaces[i]]);
144 const label srcCelli,
153 treeBoundBox bbTgtCell(tgt_.points(), tgt_.faces()[cellFaces[0]]);
154 for (label i = 1; i < cellFaces.
size(); ++i)
156 bbTgtCell.
add(tgt_.points(), tgt_.faces()[cellFaces[i]]);
170 if (volAndInertia.
first() <= ROOTVSMALL)
172 volAndInertia.
first() = 0.0;
180 return volAndInertia;
195 for (
const label nbrCelli : nbrCells)
197 if (!visitedCells.
found(nbrCelli))
213 srcToTgtAddr.
setSize(src_.nCells());
214 srcToTgtWght.
setSize(src_.nCells());
215 tgtToSrcAddr.
setSize(tgt_.nCells());
216 tgtToSrcWght.
setSize(tgt_.nCells());
222 else if (!tgt_.nCells())
226 Pout<<
"mesh interpolation: have " << src_.nCells() <<
" source "
227 <<
" cells but no target cells" <<
endl;
253 Pout<<
"mesh interpolation: cells not on processor: Source cells = "
279 word fName(
"addressing_" + mesh1.
name() +
"_to_" + mesh2.
name());
286 OFstream os(src_.time().path()/fName +
".obj");
289 forAll(mesh1ToMesh2Addr, i)
291 const labelList& addr = mesh1ToMesh2Addr[i];
294 label celli = addr[j];
302 os <<
"v " <<
p.x() <<
' ' <<
p.y() <<
' ' <<
p.z() <<
nl;
304 os <<
"v " << c0.
x() <<
' ' << c0.
y() <<
' ' << c0.
z()
307 os <<
"l " << vertI - 1 <<
' ' << vertI <<
nl;
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
label appendUniq(const T &val)
Append an element if not already in the list.
const word & name() const noexcept
Return the object name.
void setSize(const label n)
Alias for resize()
void append(const T &val)
Append an element at the end of the list.
Output to file stream, using an OSstream.
A 2-tuple for storing two objects of dissimilar types. The container is similar in purpose to std::pa...
const T1 & first() const noexcept
Return first.
const T2 & second() const noexcept
Return second.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
bool found(const T &val, label pos=0) const
True if the value if found in the list.
void size(const label n)
Older name for setAddressableSize.
static bool & parRun() noexcept
Test if this a parallel run.
const Cmpt & z() const
Access to the vector z component.
const Cmpt & y() const
Access to the vector y component.
const Cmpt & x() const
Access to the vector x component.
A bounding box defined in terms of min/max extrema points.
bool overlaps(const boundBox &bb) const
Overlaps/touches boundingBox?
const point & min() const
Minimum describing the bounding box.
const point & max() const
Maximum describing the bounding box.
void add(const boundBox &bb)
Extend to include the second box.
void inflate(const scalar s)
Inflate box by factor*mag(span) in all dimensions.
A cell is defined as a list of faces with extra functionality.
Base class for mesh-to-mesh calculation methods.
const polyMesh & tgt_
Reference to the target mesh.
void writeConnectivity(const polyMesh &mesh1, const polyMesh &mesh2, const labelListList &mesh1ToMesh2Addr) const
Write the connectivity (debugging)
const polyMesh & src_
Reference to the source mesh.
static scalar tolerance_
Tolerance used in volume overlap calculations.
virtual scalar interVol(const label srcCelli, const label tgtCelli) const
Return the intersection volume between two cells.
virtual void appendNbrCells(const label tgtCelli, const polyMesh &mesh, const DynamicList< label > &visitedTgtCells, DynamicList< label > &nbrTgtCellIDs) const
Append target cell neighbour cells to cellIDs list.
labelList maskCells() const
Return src cell IDs for the overlap region.
virtual ~meshToMeshMethod()
Destructor.
virtual bool intersect(const label srcCelli, const label tgtCelli) const
Return the true if cells intersect.
virtual Tuple2< scalar, point > interVolAndCentroid(const label srcCellI, const label tgtCellI)
Return the intersection volume and centroid between two cells.
Mesh consisting of general polyhedral cells.
virtual const faceList & faces() const
Return raw faces.
const boundBox & bounds() const
Return mesh bounding box.
virtual const pointField & points() const
Return raw points.
const vectorField & cellCentres() const
const labelListList & cellCells() const
label nCells() const noexcept
Number of mesh cells.
const cellList & cells() const
int myProcNo() const noexcept
Return processor number.
Calculates the overlap volume of two cells using tetrahedral decomposition.
scalar cellCellOverlapVolumeMinDecomp(const primitiveMesh &meshA, const label cellAI, const primitiveMesh &meshB, const label cellBI, const treeBoundBox &cellBbB) const
Calculates the overlap volume.
Tuple2< scalar, point > cellCellOverlapMomentMinDecomp(const primitiveMesh &meshA, const label cellAI, const primitiveMesh &meshB, const label cellBI, const treeBoundBox &cellBbB) const
Calculates the overlap volume and moment.
Standard boundBox with extra functionality for use in octree.
void initialise()
Initialise integral-scale box properties.
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
OBJstream os(runTime.globalPath()/outputName)
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Ostream & endl(Ostream &os)
Add newline and flush stream.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
static constexpr const zero Zero
Global zero (0)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
constexpr char nl
The newline '\n' character (0x0a)
#define defineRunTimeSelectionTable(baseType, argNames)
Define run-time selection table.
#define forAll(list, i)
Loop across all elements in list.