55 for (label srcCelli = 0; srcCelli <
src_.
nCells(); ++srcCelli)
58 if (intersectBb.overlaps(cellBb))
60 cells.append(srcCelli);
79 scalar threshold = tolerance_*src_.cellVolumes()[srcCelli];
81 tetOverlapVolume overlapEngine;
83 treeBoundBox bbTgtCell(tgt_.cellBb(tgtCelli));
85 return overlapEngine.cellCellOverlapMinDecomp
123 const label srcCelli,
142 if (volAndInertia.first() <= ROOTVSMALL)
144 volAndInertia.
first() = 0.0;
145 volAndInertia.second() =
Zero;
149 volAndInertia.second() /= volAndInertia.first();
152 return volAndInertia;
159 const polyMesh&
mesh,
160 const DynamicList<label>& visitedCells,
161 DynamicList<label>& nbrCellIDs
167 for (
const label nbrCelli : nbrCells)
169 if (!visitedCells.contains(nbrCelli))
185 srcToTgtAddr.setSize(src_.nCells());
186 srcToTgtWght.setSize(src_.nCells());
187 tgtToSrcAddr.setSize(tgt_.nCells());
188 tgtToSrcWght.setSize(tgt_.nCells());
194 else if (!tgt_.nCells())
198 Pout<<
"mesh interpolation: have " << src_.nCells() <<
" source " 199 <<
" cells but no target cells" <<
endl;
211 Foam::meshToMeshMethod::meshToMeshMethod
225 Pout<<
"mesh interpolation: cells not on processor: Source cells = " 251 word fName(
"addressing_" + mesh1.
name() +
"_to_" + mesh2.
name());
258 OFstream
os(src_.time().path()/fName +
".obj");
261 forAll(mesh1ToMesh2Addr, i)
263 const labelList& addr = mesh1ToMesh2Addr[i];
266 label celli = addr[j];
269 const cell&
c = mesh2.
cells()[celli];
274 os <<
"v " <<
p.x() <<
' ' <<
p.y() <<
' ' <<
p.z() <<
nl;
276 os <<
"v " << c0.x() <<
' ' << c0.y() <<
' ' << c0.z()
279 os <<
"l " << vertI - 1 <<
' ' << vertI <<
nl;
const polyMesh & src_
Reference to the source mesh.
A 2-tuple for storing two objects of dissimilar types. The container is similar in purpose to std::pa...
const word & name() const noexcept
Return the object name.
void inflate(const scalar factor)
Expand box by factor*mag(span) in all dimensions.
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
static bool & parRun() noexcept
Test if this a parallel run.
virtual ~meshToMeshMethod()
Destructor.
A bounding box defined in terms of min/max extrema points.
const cellList & cells() const
static int myProcNo(const label communicator=worldComm)
Rank of this process in the communicator (starting from masterNo()). Can be negative if the process i...
label push_uniq(const T &val)
Append an element if not already in the list.
List< labelList > labelListList
List of labelList.
void writeConnectivity(const polyMesh &mesh1, const polyMesh &mesh2, const labelListList &mesh1ToMesh2Addr) const
Write the connectivity (debugging)
virtual scalar interVol(const label srcCelli, const label tgtCelli) const
Return the intersection volume between two cells.
static scalar tolerance_
Tolerance used in volume overlap calculations.
virtual const pointField & points() const
Return raw points.
#define forAll(list, i)
Loop across all elements in list.
vectorField pointField
pointField is a vectorField.
const dimensionedScalar e
Elementary charge.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
List< scalarList > scalarListList
List of scalarList.
A class for handling words, derived from Foam::string.
Calculates the overlap volume of two cells using tetrahedral decomposition.
labelList maskCells() const
Return src cell IDs for the overlap region.
virtual const faceList & faces() const
Return raw faces.
const vectorField & cellCentres() const
const polyMesh & tgt_
Reference to the target mesh.
virtual bool initialise(labelListList &srcToTgtAddr, scalarListList &srcToTgtWght, labelListList &tgtToTgtAddr, scalarListList &tgtToTgtWght) const
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
int debug
Static debugging option.
OBJstream os(runTime.globalPath()/outputName)
defineTypeNameAndDebug(combustionModel, 0)
Base class for mesh-to-mesh calculation methods.
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.
vector point
Point is a vector.
virtual Tuple2< scalar, point > interVolAndCentroid(const label srcCellI, const label tgtCellI)
Return the intersection volume and centroid between two cells.
label nCells() const noexcept
Number of mesh cells.
const dimensionedScalar c
Speed of light in a vacuum.
Standard boundBox with extra functionality for use in octree.
const boundBox & bounds() const noexcept
Return mesh bounding box.
Mesh consisting of general polyhedral cells.
List< label > labelList
A List of labels.
const T1 & first() const noexcept
Access the first element.
virtual bool intersect(const label srcCelli, const label tgtCelli) const
Return the true if cells intersect.
boundBox cellBb(const label celli) const
The bounding box for given cell index.
const labelListList & cellCells() const
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
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.
static constexpr const zero Zero
Global zero (0)