51 src_.cellCentres()[srcCelli],
62 const label startSeedI,
67 const cellList& srcCells = src_.cells();
68 const faceList& srcFaces = src_.faces();
71 for (label i = startSeedI; i < srcCellIDs.
size(); i++)
73 label srcI = srcCellIDs[i];
77 const point srcCtr(srcCells[srcI].centre(srcPts, srcFaces));
78 label tgtI = tgt_.cellTree().findInside(srcCtr);
80 if (tgtI != -1 && intersect(srcI, tgtI))
105 const label srcSeedI,
106 const label tgtSeedI,
115 List<DynamicList<label>> srcToTgt(src_.nCells());
116 List<DynamicList<label>> tgtToSrc(tgt_.nCells());
118 DynamicList<label> srcSeeds(10);
123 label srcCelli = srcSeedI;
124 label tgtCelli = tgtSeedI;
129 srcToTgt[srcCelli].append(tgtCelli);
130 tgtToSrc[tgtCelli].append(srcCelli);
133 mapFlag[srcCelli] =
false;
136 V_ += srcVc[srcCelli];
148 while (srcCelli >= 0);
151 forAll(srcToTgtCellAddr, i)
153 srcToTgtCellWght[i] =
scalarList(srcToTgt[i].size(), srcVc[i]);
154 srcToTgtCellAddr[i].transfer(srcToTgt[i]);
157 forAll(tgtToSrcCellAddr, i)
159 tgtToSrcCellWght[i] =
scalarList(tgtToSrc[i].size(), tgtVc[i]);
160 tgtToSrcCellAddr[i].transfer(tgtToSrc[i]);
169 DynamicList<label>& srcSeeds,
174 const labelList& srcNbr = src_.cellCells()[srcSeedI];
175 const labelList& tgtNbr = tgt_.cellCells()[tgtSeedI];
177 for (
const label srcI : srcNbr)
179 if (mapFlag[srcI] && (srcTgtSeed[srcI] == -1))
185 for (
const label tgtI : tgtNbr)
187 if (intersect(srcI, tgtI))
192 srcTgtSeed[srcI] = tgtI;
193 srcSeeds.push_back(srcI);
202 mapFlag[srcI] =
false;
207 if (!srcSeeds.empty())
209 srcSeedI = srcSeeds.back();
210 tgtSeedI = srcTgtSeed[srcSeedI];
222Foam::directMethod::directMethod
228 meshToMeshMethod(
src,
tgt)
267 boolList mapFlag(src_.nCells(),
false);
273 label startSeedI = 0;
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
void pop_back(label n=1)
Reduce size by 1 or more elements. Can be called on an empty list.
void push_back(const T &val)
Copy append an element to the end of this list.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void transfer(List< T > &list)
Transfer the contents of the argument List into this list and annul the argument list.
void append(const T &val)
Append an element at the end of the list.
bool empty() const noexcept
True if List is empty (ie, size() is zero).
T & back()
Access last element of the list, position [size()-1].
void size(const label n)
Older name for setAddressableSize.
Direct (one-to-one cell correspondence) mesh-to-mesh interpolation class.
virtual bool findInitialSeeds(const labelList &srcCellIDs, const boolList &mapFlag, const label startSeedI, label &srcSeedI, label &tgtSeedI) const
Find indices of overlapping cells in src and tgt meshes - returns.
virtual ~directMethod()
Destructor.
virtual void calculateAddressing(labelListList &srcToTgtCellAddr, scalarListList &srcToTgtCellWght, labelListList &tgtToSrcCellAddr, scalarListList &tgtToSrcCellWght, const label srcSeedI, const label tgtSeedI, const labelList &srcCellIDs, boolList &mapFlag, label &startSeedI)
Calculate the mesh-to-mesh addressing and weights.
virtual void calculate(labelListList &srcToTgtAddr, scalarListList &srcToTgtWght, pointListList &srcToTgtVec, labelListList &tgtToSrcAddr, scalarListList &tgtToSrcWght, pointListList &tgtToSrcVec)
Calculate addressing and weights and optionally offset vectors.
virtual void appendToDirectSeeds(boolList &mapFlag, labelList &srcTgtSeed, DynamicList< label > &srcSeeds, label &srcSeedI, label &tgtSeedI) const
Append to list of src mesh seed indices.
virtual bool intersect(const label srcCelli, const label tgtCelli) const
Return the true if cells intersect.
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.
const polyMesh & src_
Reference to the source mesh.
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 bool initialise(labelListList &srcToTgtAddr, scalarListList &srcToTgtWght, labelListList &tgtToTgtAddr, scalarListList &tgtToTgtWght) const
Mesh consisting of general polyhedral cells.
bool pointInCell(const point &p, label celli, const cellDecomposition=CELL_TETS) const
Test if point p is in the celli.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Namespace for handling debugging switches.
List< scalarList > scalarListList
List of scalarList.
List< labelList > labelListList
List of labelList.
List< label > labelList
A List of labels.
List< face > faceList
List of faces.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Ostream & endl(Ostream &os)
Add newline and flush stream.
List< cell > cellList
List of cell.
vector point
Point is a vector.
List< bool > boolList
A List of bools.
UIndirectList< bool > boolUIndList
UIndirectList of bools.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
vectorField pointField
pointField is a vectorField.
List< scalar > scalarList
List of scalar.
List< pointList > pointListList
List of pointList.
#define forAll(list, i)
Loop across all elements in list.