Go to the documentation of this file.
36 return cloudObjs.cfindObject<IOField<Type>>(
name) !=
nullptr;
44 const IOobjectList cloudObjs
47 const IOobject* obj = cloudObjs.cfindObject<IOField<Type>>(
name);
50 IOField<Type> newField(*obj);
51 return tmp<Field<Type>>
::New(std::move(newField));
55 <<
"Error: cloud field name " <<
name
56 <<
" not found or the wrong type"
59 return Field<Type>::null();
66 PtrList<List<Type>>&
values,
67 const List<word>& fieldNames,
68 const IOobjectList& cloudObjs
73 const word& fieldName = fieldNames[fieldi];
75 const IOobject* obj = cloudObjs.cfindObject<IOField<Type>>(fieldName);
78 Info<<
" reading field " << fieldName <<
endl;
79 IOField<Type> newField(*obj);
80 values.set(fieldi,
new List<Type>(std::move(newField)));
85 <<
"Unable to read field " << fieldName
95 os << value.component(0);
96 for (label i=1; i<pTraits<Type>::nComponents; i++)
98 os <<
' ' << value.component(i);
107 const PtrList<List<Type>>&
values,
108 const List<List<label>>& addr,
109 const List<word>& fieldNames
112 label step =
max(floor(8/pTraits<Type>::nComponents), 1);
116 Info<<
" writing field " << fieldNames[fieldi] <<
endl;
117 os <<
nl << fieldNames[fieldi] <<
' '
118 << int(pTraits<Type>::nComponents) <<
' '
119 <<
values[fieldi].size() <<
" float" <<
nl;
123 const List<label> ids(addr[tracki]);
125 List<Type> data(UIndirectList<Type>(
values[fieldi], ids));
126 label nData = data.size() - 1;
129 writeVTK<Type>(os, data[i]);
130 if (((i + 1) % step == 0) || (i == nData))
139 offset += ids.size();
149 const List<List<label>>& addr,
150 const List<word>& userFieldNames,
151 const IOobjectList& cloudObjs
154 IOobjectList objects(cloudObjs.lookupClass(IOField<Type>::typeName));
158 DynamicList<word> fieldNames(objects.size());
161 const IOobject* obj = objects.findObject(userFieldNames[i]);
164 fieldNames.append(obj->name());
169 PtrList<List<Type>>
values(fieldNames.size());
170 readFields<Type>(
values, fieldNames, cloudObjs);
A class for managing temporary objects.
List< T > values(const HashTable< T, Key, Hash > &tbl, const bool doSort=false)
List of values from HashTable, optionally sorted.
Ostream & endl(Ostream &os)
Add newline and flush stream.
tmp< Field< Type > > readParticleField(const word &name, const IOobjectList cloudObjs)
#define forAll(list, i)
Loop across all elements in list.
void writeVTK(OFstream &os, const Type &value)
messageStream Info
Information stream (uses stdout - output is on the master only)
word name(const complex &c)
Return string representation of complex.
void writeVTKFields(OFstream &os, const PtrList< List< Type >> &values, const List< List< label >> &addr, const List< word > &fieldNames)
bool fieldOk(const IOobjectList &cloudObjs, const word &name)
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
errorManip< error > abort(error &err)
void readFields(const typename GeoFieldType::Mesh &mesh, const IOobjectList &objects, const wordHashSet &selectedFields, LIFOStack< regIOobject * > &storedObjects)
Read the selected GeometricFields of the templated type.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void processFields(OFstream &os, const List< List< label >> &addr, const List< word > &userFieldNames, const IOobjectList &cloudObjs)