48 max(src_.bounds().min(), tgt_.bounds().min()),
49 min(src_.bounds().max(), tgt_.bounds().max())
54 const cellList& srcCells = src_.cells();
55 const faceList& srcFaces = src_.faces();
83 scalar threshold = tolerance_*src_.cellVolumes()[srcCelli];
87 treeBoundBox bbTgtCell(tgt_.points(), tgt_.cellPoints()[tgtCelli]);
103 const label srcCelli,
109 treeBoundBox bbTgtCell(tgt_.points(), tgt_.cellPoints()[tgtCelli]);
137 label nbrCelli = nbrCells[i];
141 (
findIndex(visitedCells, nbrCelli) == -1)
142 && (
findIndex(nbrCellIDs, nbrCelli) == -1)
145 nbrCellIDs.
append(nbrCelli);
159 srcToTgtAddr.
setSize(src_.nCells());
160 srcToTgtWght.
setSize(src_.nCells());
161 tgtToSrcAddr.
setSize(tgt_.nCells());
162 tgtToSrcWght.
setSize(tgt_.nCells());
168 else if (!tgt_.nCells())
172 Pout<<
"mesh interpolation: hhave " << src_.nCells() <<
" source " 173 <<
" cells but no target cells" <<
endl;
185 Foam::meshToMeshMethod::meshToMeshMethod
195 if (!src_.nCells() || !tgt_.nCells())
199 Pout<<
"mesh interpolation: cells not on processor: Source cells = " 200 << src_.nCells() <<
", target cells = " << tgt_.nCells()
225 word fName(
"addressing_" + mesh1.
name() +
"_to_" + mesh2.
name());
232 OFstream os(src_.time().path()/fName +
".obj");
235 forAll(mesh1ToMesh2Addr, i)
237 const labelList& addr = mesh1ToMesh2Addr[i];
240 label celli = addr[j];
248 os <<
"v " << p.
x() <<
' ' << p.
y() <<
' ' << p.
z() <<
nl;
250 os <<
"v " << c0.
x() <<
' ' << c0.
y() <<
' ' << c0.
z()
253 os <<
"l " << vertI - 1 <<
' ' << vertI <<
nl;
bool overlaps(const boundBox &) const
Overlaps/touches boundingBox?
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
const word & name() const
Return name.
const double e
Elementary charge.
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
void size(const label)
Override size to be inconsistent with allocated storage.
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual ~meshToMeshMethod()
Destructor.
A bounding box defined in terms of the points at its extremities.
const cellList & cells() const
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.
A class for handling words, derived from string.
Calculates the overlap volume of two cells using tetrahedral decomposition.
void append(const T &)
Append an element at the end of the list.
labelList maskCells() const
Return src cell IDs for the overlap region.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
virtual const faceList & faces() const
Return raw faces.
const vectorField & cellCentres() const
void inflate(const scalar s)
Inflate box by factor*mag(span) in all dimensions.
virtual bool initialise(labelListList &srcToTgtAddr, scalarListList &srcToTgtWght, labelListList &tgtToTgtAddr, scalarListList &tgtToTgtWght) const
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
defineTypeNameAndDebug(combustionModel, 0)
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurence of given element and return index,.
virtual void appendNbrCells(const label tgtCelli, const polyMesh &mesh, const DynamicList< label > &visitedTgtCells, DynamicList< label > &nbrTgtCellIDs) const
Append target cell neihgbour cells to cellIDs list.
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
word name(const complex &)
Return a string representation of a complex.
void setSize(const label)
Reset size of List.
static bool & parRun()
Is this a parallel run?
A cell is defined as a list of faces with extra functionality.
prefixOSstream Pout(cout, "Pout")
const dimensionedScalar c
Speed of light in a vacuum.
pointField points(const faceUList &, const pointField &) const
Return the cell vertices.
Standard boundBox + extra functionality for use in octree.
bool cellCellOverlapMinDecomp(const primitiveMesh &meshA, const label cellAI, const primitiveMesh &meshB, const label cellBI, const treeBoundBox &cellBbB, const scalar threshold=0.0) const
Return true if olverlap volume is greater than threshold.
Mesh consisting of general polyhedral cells.
virtual bool intersect(const label srcCelli, const label tgtCelli) const
Return the true if cells intersect.
const labelListList & cellCells() const
scalar cellCellOverlapVolumeMinDecomp(const primitiveMesh &meshA, const label cellAI, const primitiveMesh &meshB, const label cellBI, const treeBoundBox &cellBbB) const
Calculates the overlap volume.