55 for (label srcCelli = 0; srcCelli <
src_.
nCells(); ++srcCelli)
58 if (intersectBb.overlaps(cellBb))
60 cells.append(srcCelli);
66 Pout<<
"participating source mesh cells: " <<
src_.nCells() <<
endl;
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;
152 return volAndInertia;
159 const polyMesh&
mesh,
161 DynamicList<label>& nbrCellIDs
167 for (
const label nbrCelli : nbrCells)
169 if (!visitedCells.contains(nbrCelli))
171 nbrCellIDs.push_uniq(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;
211Foam::meshToMeshMethod::meshToMeshMethod
225 Pout<<
"mesh interpolation: cells not on processor: Source cells = "
226 << src_.nCells() <<
", target cells = " << tgt_.nCells()
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;
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
label push_uniq(const T &val)
Append an element if not already in the list.
const word & name() const noexcept
Return the object name.
void setSize(label n)
Alias for resize().
Output to file stream as an OSstream, normally using std::ofstream for the actual output.
A 2-tuple for storing two objects of dissimilar types. The container is similar in purpose to std::pa...
const T1 & first() const noexcept
Access the first element.
const T2 & second() const noexcept
Access the second element.
bool contains(const T &val) const
True if the value is contained in the list.
static int myProcNo(const label communicator=worldComm)
Rank of this process in the communicator (starting from masterNo()). Negative if the process is not a...
static bool parRun(const bool on) noexcept
Set as parallel run on/off.
const Cmpt & x() const noexcept
Access to the vector x component.
const Cmpt & z() const noexcept
Access to the vector z component.
const Cmpt & y() const noexcept
Access to the vector y component.
A bounding box defined in terms of min/max extrema points.
bool overlaps(const boundBox &bb) const
Overlaps/touches boundingBox?
void inflate(const scalar factor)
Expand 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.
const polyMesh & src() const
Return const access to the source 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.
const polyMesh & tgt() const
Return const access to the target mesh.
labelList maskCells() const
Return src cell IDs for the overlap region.
scalar V_
Cell total volume in overlap region [m3].
virtual ~meshToMeshMethod()
Destructor.
virtual bool intersect(const label srcCelli, const label tgtCelli) const
Return the true if cells intersect.
virtual bool initialise(labelListList &srcToTgtAddr, scalarListList &srcToTgtWght, labelListList &tgtToTgtAddr, scalarListList &tgtToTgtWght) const
virtual Tuple2< scalar, point > interVolAndCentroid(const label srcCellI, const label tgtCellI)
Return the intersection volume and centroid between two cells.
virtual void appendNbrCells(const label tgtCelli, const polyMesh &mesh, const labelUList &visitedTgtCells, DynamicList< label > &nbrTgtCellIDs) const
Append target cell neighbour cells to cellIDs list.
Mesh consisting of general polyhedral cells.
virtual const faceList & faces() const
Return raw faces.
const boundBox & bounds() const noexcept
Return mesh bounding box.
virtual const pointField & points() const
Return raw points.
const vectorField & cellCentres() const
label nCells() const noexcept
Number of mesh cells.
boundBox cellBb(const label celli) const
The bounding box for given cell index.
const cellList & cells() const
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.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
OBJstream os(runTime.globalPath()/outputName)
Namespace for handling debugging switches.
List< scalarList > scalarListList
List of scalarList.
List< labelList > labelListList
List of labelList.
List< label > labelList
A List of labels.
Ostream & endl(Ostream &os)
Add newline and flush stream.
vector point
Point is a vector.
static constexpr const zero Zero
Global zero (0).
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
vectorField pointField
pointField is a vectorField.
UList< label > labelUList
A UList of labels.
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.