53 accessOp<List<Type>>()
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();
188 srcMesh.time().timePath()/cloud::prefix,
195 Info<<
nl <<
"Mapping cloud " << cloudDirs[cloudi] <<
endl;
198 passiveParticleCloud srcCloud(srcMesh, cloudDirs[cloudi],
false);
202 <<
" parcels from source mesh." <<
endl;
207 List<DynamicList<label>> sendsDyn(Pstream::nProcs());
209 label srcParticlei = 0;
212 const point pos = iter().position(srcMesh);
214 const remote tgtProcCell =
215 interp.srcToTgtPoint(iter().cell(),
pos);
217 positions[srcParticlei] =
pos;
218 tgtCells[srcParticlei] = tgtProcCell.elementi;
220 sendsDyn[tgtProcCell.proci].append(srcParticlei ++);
227 autoPtr<distributionMap> mapPtr =
229 const distributionMap& map = mapPtr();
232 map.distribute(positions);
233 map.distribute(tgtCells);
236 passiveParticleCloud tgtCloud
240 IDLList<passiveParticle>()
242 forAll(positions, tgtParticlei)
244 label nLocateBoundaryHits = 0;
245 autoPtr<passiveParticle> pPtr
250 positions[tgtParticlei],
251 tgtCells[tgtParticlei],
256 if (nLocateBoundaryHits == 0)
258 tgtCloud.addParticle(pPtr.ptr());
264 <<
" parcels to the target mesh." <<
endl;
267 IOPosition<passiveParticleCloud>(tgtCloud).
write();
273 srcMesh.time().name(),
274 cloud::prefix/cloudDirs[cloudi]
278 #define MapCloudTypeFields(Type, nullArg) \
279 mapCloudTypeFieldsAndFieldFields<Type> \
287 MapCloudTypeFields(
label, );
289 #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 char)=0
Write character.
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.
#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.
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)
void gatherAndFlatten(DynamicField< Type > &field)
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.