57 void Foam::meshToMesh::mapAndOpSrcToTgt
68 void Foam::meshToMesh::mapAndOpSrcToTgt
79 void Foam::meshToMesh::mapAndOpSrcToTgt
90 void Foam::meshToMesh::mapAndOpSrcToTgt
101 void Foam::meshToMesh::mapAndOpSrcToTgt
112 void Foam::meshToMesh::mapAndOpTgtToSrc
123 void Foam::meshToMesh::mapAndOpTgtToSrc
134 void Foam::meshToMesh::mapAndOpTgtToSrc
145 void Foam::meshToMesh::mapAndOpTgtToSrc
156 void Foam::meshToMesh::mapAndOpTgtToSrc
203 void Foam::meshToMesh::normaliseWeights
205 const word& descriptor,
230 void Foam::meshToMesh::calcAddressing
232 const word& methodName,
264 void Foam::meshToMesh::calculate(
const word& methodName)
266 Info<<
"Creating mesh-to-mesh addressing for " << srcRegion_.name()
267 <<
" and " << tgtRegion_.name() <<
" regions using " 268 << methodName <<
endl;
270 singleMeshProc_ = calcDistribution(srcRegion_, tgtRegion_);
272 if (singleMeshProc_ == -1)
290 distributeAndMergeCells
298 newTgtFaceNeighbours,
309 tgtRegion_.time().timeName(),
315 move(newTgtFaceOwners),
316 move(newTgtFaceNeighbours),
325 newTgt.nFaces() - newTgt.nInternalFaces(),
326 newTgt.nInternalFaces(),
328 newTgt.boundaryMesh(),
332 newTgt.addPatches(patches);
335 (void)newTgt.tetBasePtIs();
342 Pout<<
"Created newTgt mesh:" <<
nl 343 <<
" old cells = " << tgtRegion_.nCells()
344 <<
", new cells = " << newTgt.nCells() <<
nl 345 <<
" old faces = " << tgtRegion_.nFaces()
346 <<
", new faces = " << newTgt.nFaces() <<
endl;
350 Pout<<
"Writing newTgt mesh: " << newTgt.
name() <<
endl;
355 calcAddressing(methodName, srcRegion_, newTgt);
358 forAll(srcToTgtCellAddr_, i)
360 labelList& addressing = srcToTgtCellAddr_[i];
363 addressing[addrI] = newTgtCellIDs[addressing[addrI]];
368 forAll(tgtToSrcCellAddr_, i)
370 labelList& addressing = tgtToSrcCellAddr_[i];
373 addressing[addrI] = globalSrcCells.toGlobal(addressing[addrI]);
440 calcAddressing(methodName, srcRegion_, tgtRegion_);
457 Info<<
" Overlap volume: " << V_ <<
endl;
476 case imCellVolumeWeight:
484 <<
"Unhandled enumeration " << method
493 void Foam::meshToMesh::calculatePatchAMIs(
const word& AMIMethodName)
495 if (!patchAMIs_.empty())
498 <<
"patch AMI already calculated" 502 patchAMIs_.setSize(srcPatchID_.size());
506 label srcPatchi = srcPatchID_[i];
507 label tgtPatchi = tgtPatchID_[i];
512 Info<<
"Creating AMI between source patch " << srcPP.
name()
513 <<
" and target patch " << tgtPP.
name()
514 <<
" using " << AMIMethodName
539 void Foam::meshToMesh::constructNoCuttingPatches
541 const word& methodName,
542 const word& AMIMethodName,
543 const bool interpAllPatches
546 if (interpAllPatches)
560 if (!isA<processorPolyPatch>(pp))
568 tgtPatchID.append(tgtPatchi);
573 <<
"Source patch " << pp.
name()
574 <<
" not found in target mesh. " 575 <<
"Available target patches are " << tgtBM.
names()
581 srcPatchID_.transfer(srcPatchID);
582 tgtPatchID_.transfer(tgtPatchID);
586 calculate(methodName);
589 calculatePatchAMIs(AMIMethodName);
593 void Foam::meshToMesh::constructFromCuttingPatches
595 const word& methodName,
596 const word& AMIMethodName,
601 srcPatchID_.setSize(patchMap.
size());
602 tgtPatchID_.setSize(patchMap.
size());
607 const word& tgtPatchName = iter.key();
608 const word& srcPatchName = iter();
613 srcPatchID_[i] = srcPatch.
index();
614 tgtPatchID_[i] = tgtPatch.
index();
619 calculate(methodName);
622 calculatePatchAMIs(AMIMethodName);
625 cuttingPatches_.setSize(cuttingPatches.
size());
626 forAll(cuttingPatches_, i)
628 const word& patchName = cuttingPatches[i];
629 cuttingPatches_[i] = tgtRegion_.boundaryMesh().findPatchID(patchName);
641 bool interpAllPatches
659 constructNoCuttingPatches
661 interpolationMethodNames_[method],
664 interpolationMethodAMI(method)
675 const word& methodName,
676 const word& AMIMethodName,
677 bool interpAllPatches
695 constructNoCuttingPatches(methodName, AMIMethodName, interpAllPatches);
723 constructFromCuttingPatches
725 interpolationMethodNames_[method],
728 interpolationMethodAMI(method)
740 const word& methodName,
741 const word& AMIMethodName,
761 constructFromCuttingPatches
static word interpolationMethodToWord(const interpolationMethod &method)
Convert interpolationMethod to word representation.
Class containing functor to negate primitives. Dummy for all other types.
bool overlaps(const boundBox &) const
Overlaps/touches boundingBox?
virtual const fileName & name() const
Return the name of the stream.
void append(T *)
Append an element at the end of the list.
#define forAll(list, i)
Loop across all elements in list.
virtual Ostream & write(const char)=0
Write character.
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.
errorManipArg< error, int > exit(error &err, const int errNo=1)
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const polyBoundaryMesh & boundaryMesh() const
Return boundaryMesh reference.
const labelListList & subMap() const
From subsetted data back to original data.
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.
Plus op for FixedList<scalar>
static const NamedEnum< interpolationMethod, 3 > interpolationMethodNames_
label findPatchID(const word &patchName) const
Find patch index given a name.
scalar V() const
Return const access to the overlap volume.
A bounding box defined in terms of the points at its extremities.
const cellList & cells() const
Initialise the NamedEnum HashTable from the static list of names.
label size() const
Return number of elements in table.
void writeConnectivity(const polyMesh &mesh1, const polyMesh &mesh2, const labelListList &mesh1ToMesh2Addr) const
Write the connectivity (debugging)
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
interpolationMethod
Enumeration specifying interpolation method.
virtual void calculate(labelListList &srcToTgtAddr, scalarListList &srcToTgtWght, labelListList &tgtToTgtAddr, scalarListList &tgtToTgtWght)=0
Calculate addressing and weights.
virtual const pointField & points() const
Return raw points.
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
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))
A class for handling words, derived from string.
wordList names() const
Return a list of patch names.
void append(const T &)
Append an element at the end of the list.
List< scalar > scalarList
A List of scalars.
static void distribute(const Pstream::commsTypes commsType, const List< labelPair > &schedule, const label constructSize, const labelListList &subMap, const bool subHasFlip, const labelListList &constructMap, const bool constructHasFlip, List< T > &, const negateOp &negOp, const int tag=UPstream::msgType())
Distribute data. Note:schedule only used for.
static const word null
An empty word.
List< label > labelList
A List of labels.
virtual const faceList & faces() const
Return raw faces.
An STL-conforming hash table.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
errorManip< error > abort(error &err)
void inflate(const scalar s)
Inflate box by factor*mag(span) in all dimensions.
static AMIInterpolation::interpolationMethod interpolationMethodAMI(const interpolationMethod method)
Conversion between mesh and patch interpolation methods.
defineTypeNameAndDebug(combustionModel, 0)
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
word name(const complex &)
Return a string representation of a complex.
label size() const
Return the number of elements in the UPtrList.
const point & max() const
Maximum describing the bounding box.
const boundBox & bounds() const
Return mesh bounding box.
meshToMesh(const polyMesh &src, const polyMesh &tgt, const interpolationMethod &method, const bool interpAllPatches=true)
Construct from source and target meshes.
Class containing processor-to-processor mapping information.
virtual ~meshToMesh()
Destructor.
prefixOSstream Pout(cout, "Pout")
label index() const
Return the index of this patch in the boundaryMesh.
Interpolation class dealing with transfer of data between two primitive patches with an arbitrary mes...
const labelListList & constructMap() const
From subsetted data to new reconstructed data.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Mesh consisting of general polyhedral cells.
const point & min() const
Minimum describing the bounding box.
interpolationMethod
Enumeration specifying interpolation method.
A patch is a list of labels that address the faces in the global face list.
Ostream & incrIndent(Ostream &os)
Increment the indent level.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
static autoPtr< meshToMeshMethod > New(const word &methodName, const polyMesh &src, const polyMesh &tgt)
Selector.