93 void Foam::meshToMesh::normaliseWeights
95 const word& descriptor,
120 void Foam::meshToMesh::calcAddressing
122 const word& methodName,
154 void Foam::meshToMesh::calculate(
const word& methodName)
156 Info<<
"Creating mesh-to-mesh addressing for " << srcRegion_.name()
157 <<
" and " << tgtRegion_.name() <<
" regions using " 158 << methodName <<
endl;
160 singleMeshProc_ = calcDistribution(srcRegion_, tgtRegion_);
162 if (singleMeshProc_ == -1)
180 distributeAndMergeCells
188 newTgtFaceNeighbours,
199 tgtRegion_.time().timeName(),
215 newTgt.nFaces() - newTgt.nInternalFaces(),
216 newTgt.nInternalFaces(),
218 newTgt.boundaryMesh(),
222 newTgt.addPatches(patches);
225 (void)newTgt.tetBasePtIs();
232 Pout<<
"Created newTgt mesh:" <<
nl 233 <<
" old cells = " << tgtRegion_.nCells()
234 <<
", new cells = " << newTgt.nCells() <<
nl 235 <<
" old faces = " << tgtRegion_.nFaces()
236 <<
", new faces = " << newTgt.nFaces() <<
endl;
240 Pout<<
"Writing newTgt mesh: " << newTgt.
name() <<
endl;
245 calcAddressing(methodName, srcRegion_, newTgt);
248 forAll(srcToTgtCellAddr_, i)
250 labelList& addressing = srcToTgtCellAddr_[i];
253 addressing[addrI] = newTgtCellIDs[addressing[addrI]];
258 forAll(tgtToSrcCellAddr_, i)
260 labelList& addressing = tgtToSrcCellAddr_[i];
263 addressing[addrI] = globalSrcCells.toGlobal(addressing[addrI]);
324 calcAddressing(methodName, srcRegion_, tgtRegion_);
341 Info<<
" Overlap volume: " << V_ <<
endl;
360 case imCellVolumeWeight:
369 "Foam::AMIPatchToPatchInterpolation::interpolationMethod" 370 "Foam::meshToMesh::interpolationMethodAMI" 372 "const interpolationMethod method" 375 <<
"Unhandled enumeration " << method
384 void Foam::meshToMesh::calculatePatchAMIs(
const word& AMIMethodName)
386 if (!patchAMIs_.empty())
389 <<
"patch AMI already calculated" 393 patchAMIs_.setSize(srcPatchID_.size());
397 label srcPatchI = srcPatchID_[i];
398 label tgtPatchI = tgtPatchID_[i];
403 Info<<
"Creating AMI between source patch " << srcPP.
name()
404 <<
" and target patch " << tgtPP.
name()
405 <<
" using " << AMIMethodName
430 void Foam::meshToMesh::constructNoCuttingPatches
432 const word& methodName,
433 const word& AMIMethodName,
434 const bool interpAllPatches
437 if (interpAllPatches)
455 tgtPatchID.append(tgtPatchI);
461 "Foam::meshToMesh::meshToMesh" 465 "const interpolationMethod&, " 468 ) <<
"Source patch " << pp.
name()
469 <<
" not found in target mesh. " 470 <<
"Available target patches are " << tgtBM.
names()
476 srcPatchID_.transfer(srcPatchID);
477 tgtPatchID_.transfer(tgtPatchID);
481 calculate(methodName);
484 calculatePatchAMIs(AMIMethodName);
488 void Foam::meshToMesh::constructFromCuttingPatches
490 const word& methodName,
491 const word& AMIMethodName,
496 srcPatchID_.setSize(patchMap.
size());
497 tgtPatchID_.setSize(patchMap.
size());
502 const word& tgtPatchName = iter.key();
503 const word& srcPatchName = iter();
508 srcPatchID_[i] = srcPatch.
index();
509 tgtPatchID_[i] = tgtPatch.
index();
514 calculate(methodName);
517 calculatePatchAMIs(AMIMethodName);
520 cuttingPatches_.setSize(cuttingPatches.
size());
521 forAll(cuttingPatches_, i)
523 const word& patchName = cuttingPatches[i];
524 cuttingPatches_[i] = tgtRegion_.boundaryMesh().findPatchID(patchName);
531 Foam::meshToMesh::meshToMesh
536 bool interpAllPatches
554 constructNoCuttingPatches
556 interpolationMethodNames_[method],
559 interpolationMethodAMI(method)
566 Foam::meshToMesh::meshToMesh
570 const word& methodName,
571 const word& AMIMethodName,
572 bool interpAllPatches
590 constructNoCuttingPatches(methodName, AMIMethodName, interpAllPatches);
594 Foam::meshToMesh::meshToMesh
618 constructFromCuttingPatches
620 interpolationMethodNames_[method],
623 interpolationMethodAMI(method)
631 Foam::meshToMesh::meshToMesh
635 const word& methodName,
636 const word& AMIMethodName,
656 constructFromCuttingPatches
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
scalar V() const
Return const access to the overlap volume.
const labelListList & subMap() const
From subsetted data back to original data.
const pointField & points
const point & min() const
Minimum describing the bounding box.
label size() const
Return the number of elements in the PtrList.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject( name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE ))
const word & name() const
Return name.
static void distribute(const Pstream::commsTypes commsType, const List< labelPair > &schedule, const label constructSize, const labelListList &subMap, const labelListList &constructMap, List< T > &, const int tag=UPstream::msgType())
Distribute data. Note:schedule only used for Pstream::scheduled.
word name(const complex &)
Return a string representation of a complex.
const labelListList & constructMap() const
From subsetted data to new reconstructed data.
Class containing processor-to-processor mapping information.
An STL-conforming hash table.
label index() const
Return the index of this patch in the boundaryMesh.
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
A class for handling words, derived from string.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
void size(const label)
Override size to be inconsistent with allocated storage.
errorManipArg< error, int > exit(error &err, const int errNo=1)
const cellList & cells() const
const polyBoundaryMesh & boundaryMesh() const
Return boundaryMesh reference.
void writeConnectivity(const polyMesh &mesh1, const polyMesh &mesh2, const labelListList &mesh1ToMesh2Addr) const
Write the connectivity (debugging)
static const NamedEnum< interpolationMethod, 3 > interpolationMethodNames_
A patch is a list of labels that address the faces in the global face list.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
wordList names() const
Return a list of patch names.
interpolationMethod
Enumeration specifying interpolation method.
Ostream & incrIndent(Ostream &os)
Increment the indent level.
interpolationMethod
Enumeration specifying interpolation method.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
virtual const pointField & points() const
Return raw points.
static AMIPatchToPatchInterpolation::interpolationMethod interpolationMethodAMI(const interpolationMethod method)
Conversion between mesh and patch interpolation methods.
virtual void calculate(labelListList &srcToTgtAddr, scalarListList &srcToTgtWght, labelListList &tgtToTgtAddr, scalarListList &tgtToTgtWght)=0
Calculate addressing and weights.
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
Interpolation class dealing with transfer of data between two primitive patches with an arbitrary mes...
static bool constraintType(const word &pt)
Return true if the given type is a constraint type.
virtual Ostream & write(const token &)=0
Write next token to stream.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
const point & max() const
Maximum describing the bounding box.
label size() const
Return number of elements in table.
List< scalar > scalarList
A List of scalars.
errorManip< error > abort(error &err)
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
virtual const fileName & name() const
Return the name of the stream.
Initialise the NamedEnum HashTable from the static list of names.
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
A bounding box defined in terms of the points at its extremities.
const cellShapeList & cells
Mesh consisting of general polyhedral cells.
const boundBox & bounds() const
Return mesh bounding box.
List< label > labelList
A List of labels.
static word interpolationMethodToWord(const interpolationMethod &method)
Convert interpolationMethod to word representation.
void append(T *)
Append an element at the end of the list.
static autoPtr< meshToMeshMethod > New(const word &methodName, const polyMesh &src, const polyMesh &tgt)
Selector.
void append(const T &)
Append an element at the end of the list.
void inflate(const scalar s)
Inflate box by factor*mag(span) in all dimensions.
virtual const faceList & faces() const
Return raw faces.
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
label findPatchID(const word &patchName) const
Find patch index given a name.
Plus op for FixedList<scalar>
bool overlaps(const boundBox &) const
Overlaps/touches boundingBox?
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
static const word null
An empty word.
defineTypeNameAndDebug(combustionModel, 0)
prefixOSstream Pout(cout,"Pout")
virtual ~meshToMesh()
Destructor.