33 Foam::sampledSets::volFieldSampler<Type>::volFieldSampler
35 const word& interpolationScheme,
36 const GeometricField<Type, fvPatchField, volMesh>& field,
37 const PtrList<sampledSet>& samplers
40 List<Field<Type>>(samplers.size()),
43 autoPtr<interpolation<Type>> interpolator
51 const sampledSet& samples = samplers[setI];
53 values.setSize(samples.size());
56 const point& samplePt = samples[sampleI];
57 label celli = samples.cells()[sampleI];
58 label facei = samples.faces()[sampleI];
60 if (celli == -1 && facei == -1)
67 values[sampleI] = interpolator().interpolate
80 Foam::sampledSets::volFieldSampler<Type>::volFieldSampler
82 const GeometricField<Type, fvPatchField, volMesh>& field,
83 const PtrList<sampledSet>& samplers
86 List<Field<Type>>(samplers.
size()),
92 const sampledSet& samples = samplers[setI];
94 values.setSize(samples.size());
97 label celli = samples.cells()[sampleI];
105 values[sampleI] = field[celli];
113 Foam::sampledSets::volFieldSampler<Type>::volFieldSampler
115 const List<Field<Type>>& values,
119 List<Field<Type>>(values),
125 void Foam::sampledSets::writeSampleFile
127 const coordSet& masterSampleSet,
128 const PtrList<volFieldSampler<Type>>& masterFields,
130 const fileName& timeDir,
131 const setWriter<Type>& formatter
134 wordList valueSetNames(masterFields.size());
135 List<const Field<Type>*> valueSets(masterFields.size());
137 forAll(masterFields, fieldi)
139 valueSetNames[fieldi] = masterFields[fieldi].name();
140 valueSets[fieldi] = &masterFields[fieldi][setI];
145 timeDir/formatter.getFileName(masterSampleSet, valueSetNames)
162 <<
"File " << ofs.name() <<
" could not be opened. " 163 <<
"No data will be written" <<
endl;
169 void Foam::sampledSets::combineSampledValues
171 const PtrList<volFieldSampler<T>>& sampledFields,
173 PtrList<volFieldSampler<T>>& masterFields
176 forAll(sampledFields, fieldi)
178 List<Field<T>> masterValues(indexSets.size());
198 masterValues[setI] = UIndirectList<T>
209 new volFieldSampler<T>
212 sampledFields[fieldi].
name()
220 void Foam::sampledSets::sampleAndWrite
222 fieldGroup<Type>& fields
227 bool interpolate = interpolationScheme_ !=
"cell";
230 if (fields.formatter.empty())
232 fields = writeFormat_;
236 PtrList<volFieldSampler<Type>> sampledFields(fields.size());
242 Pout<<
"sampledSets::sampleAndWrite: " 243 << fields[fieldi] <<
endl;
248 GeometricField<Type, fvPatchField, volMesh> vf
267 new volFieldSampler<Type>
269 interpolationScheme_,
280 new volFieldSampler<Type>(vf, *
this)
291 new volFieldSampler<Type>
293 interpolationScheme_,
295 <GeometricField<Type, fvPatchField, volMesh>>
306 new volFieldSampler<Type>
309 <GeometricField<Type, fvPatchField, volMesh>>
321 PtrList<volFieldSampler<Type>> masterFields(sampledFields.size());
322 combineSampledValues(sampledFields, indexSets_, masterFields);
326 forAll(masterSampledSets_, setI)
330 masterSampledSets_[setI],
List< labelList > labelListList
A List of labelList.
#define forAll(list, i)
Loop across all elements in list.
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 the name of this functionObject.
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
static autoPtr< interpolation< Type > > New(const word &interpolationType, const GeometricField< Type, fvPatchField, volMesh > &psi)
Return a reference to the specified interpolation scheme.
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
const T & operator[](const label) const
Return element const reference.
Ostream & endl(Ostream &os)
Add newline and flush stream.
static bool master(const label communicator=0)
Am I the master process.
static word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
const Time & time() const
Return the top-level database.
const Type & lookupObject(const word &name) const
Lookup and return the object of the given Type.
AccessType combine(const List< T > &, AccessOp aop=accessOp< T >())
Combines sublists into one big list.
word name(const complex &)
Return a string representation of a complex.
label size() const
Return the number of elements in the UPtrList.
List< word > wordList
A List of words.
static label nProcs(const label communicator=0)
Number of processes in parallel run.
vector point
Point is a vector.
#define WarningInFunction
Report a warning using Foam::Warning.
prefixOSstream Pout(cout, "Pout")
PtrList()
Null Constructor.
static void gatherList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Gather data but keep individual values separate.