59 template<
class ReadIOField,
class WriteIOField>
60 void mapCloudTypeFields
62 const fileName& cloudDir,
64 const polyMesh& srcMesh,
65 const polyMesh& tgtMesh,
66 const distributionMap& map
76 Info<<
" mapping lagrangian field " << fieldName <<
endl;
78 const IOobject* fieldIOPtr =
objects.lookup(fieldName);
88 srcMesh.time().name(),
98 map.distribute(field);
108 tgtMesh.time().name(),
123 void mapCloudTypeFieldsAndFieldFields
125 const fileName& cloudDir,
127 const polyMesh& srcMesh,
128 const polyMesh& tgtMesh,
129 const distributionMap& map
147 IOField<Field<Type>>,
148 CompactIOField<Field<Type>>
160 CompactIOField<Field<Type>>,
161 CompactIOField<Field<Type>>
179 const polyMesh& srcMesh = interp.srcMesh();
180 const polyMesh& tgtMesh = interp.tgtMesh();
190 srcMesh.time().timePath()/lagrangian::cloud::prefix,
197 Info<<
nl <<
"Mapping cloud " << cloudDirs[cloudi] <<
endl;
200 passiveParticleCloud srcCloud(srcMesh, cloudDirs[cloudi],
false);
204 <<
" parcels from source mesh." <<
endl;
211 label srcParticlei = 0;
214 const point pos = iter().position(srcMesh);
216 const remote tgtProcCell =
217 interp.srcToTgtPoint(iter().
cell(),
pos);
219 positions[srcParticlei] =
pos;
220 tgtCells[srcParticlei] = tgtProcCell.elementi;
222 sendsDyn[tgtProcCell.proci].append(srcParticlei ++);
229 autoPtr<distributionMap> mapPtr =
231 const distributionMap& map = mapPtr();
234 map.distribute(positions);
235 map.distribute(tgtCells);
238 passiveParticleCloud tgtCloud
242 IDLList<passiveParticle>()
244 forAll(positions, tgtParticlei)
246 label nLocateBoundaryHits = 0;
247 autoPtr<passiveParticle> pPtr
252 positions[tgtParticlei],
253 tgtCells[tgtParticlei],
258 if (nLocateBoundaryHits == 0)
260 tgtCloud.addParticle(pPtr.ptr());
266 <<
" parcels to the target mesh." <<
endl;
269 IOPosition<passiveParticleCloud>(tgtCloud).
write();
275 srcMesh.time().name(),
276 lagrangian::cloud::prefix/cloudDirs[cloudi]
280 #define MapCloudTypeFields(Type, nullArg) \
281 mapCloudTypeFieldsAndFieldFields<Type> \
289 MapCloudTypeFields(
label, );
291 #undef MapCloudTypeFields
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
virtual Ostream & write(const token &)
Write token.
static void scatterList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Scatter data. Reverse of gatherList.
static void gatherList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Gather data but keep individual values separate.
static label nProcs(const label communicator=0)
Number of processes in parallel run.
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
static const word prefix
The prefix to local: lagrangian.
Motion of the mesh specified as a list of pointMeshMovers.
#define FOR_ALL_FIELD_TYPES(Macro,...)
static List< word > fieldNames
AccessType combine(const List< T > &, AccessOp aop=accessOp< T >())
Combines sublists into one big list.
dimensionedScalar pos(const dimensionedScalar &ds)
List< word > wordList
A List of words.
List< fileName > fileNameList
A List of fileNames.
List< label > labelList
A List of labels.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
String typeName(const std::type_info &info)
Return the un-mangled name given the standard type info.
void mapClouds(const fvMeshToFvMesh &interp)
vectorField pointField
pointField is a vectorField.
vector point
Point is a vector.
List< labelList > labelListList
A List of labelList.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
tmp< DimensionedField< TypeR, GeoMesh, Field > > New(const tmp< DimensionedField< TypeR, GeoMesh, Field >> &tdf1, const word &name, const dimensionSet &dimensions)
fileNameList readDir(const fileName &, const fileType=fileType::file, const bool filterVariants=true, const bool followLink=true)
Read a directory and return the entries as a string list.