31 bool Foam::fieldOk(
const IOobjectList& cloudObjs,
const word& name)
33 IOobjectList
objects(cloudObjs.lookupClass(IOField<Type>::typeName));
35 return (
objects.lookup(name) !=
nullptr);
43 const IOobjectList cloudObjs
46 IOobjectList
objects(cloudObjs.lookupClass(IOField<Type>::typeName));
48 const IOobject* obj =
objects.lookup(name);
51 IOField<Type> newField(*obj);
52 return tmp<Field<Type>>(
new Field<Type>(move(newField)));
56 <<
"error: cloud field name " << name <<
" not found" 59 return Field<Type>::null();
66 PtrList<List<Type>>& values,
67 const List<word>& fieldNames,
68 const IOobjectList& cloudObjs
71 IOobjectList
objects(cloudObjs.lookupClass(IOField<Type>::typeName));
75 const IOobject* obj =
objects.lookup(fieldNames[j]);
78 Info<<
" reading field " << fieldNames[j] <<
endl;
79 IOField<Type> newField(*obj);
80 values.set(j,
new List<Type>(move(newField)));
85 <<
"Unable to read field " << fieldNames[j]
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] << ' ' << pTraits<Type>::nComponents
118 <<
' ' << values[fieldi].size() <<
" float" <<
nl;
122 const List<label> ids(addr[trackI]);
124 List<Type> data(UIndirectList<Type>(values[fieldi], ids));
125 label nData = data.size() - 1;
128 writeVTK<Type>(os, data[i]);
129 if (((i + 1) % step == 0) || (i == nData))
138 offset += ids.size();
148 const List<List<label>>& addr,
149 const List<word>& userFieldNames,
150 const IOobjectList& cloudObjs
153 IOobjectList
objects(cloudObjs.lookupClass(IOField<Type>::typeName));
160 IOobject* obj =
objects.lookup(userFieldNames[i]);
163 fieldNames.append(obj->name());
168 PtrList<List<Type>> values(fieldNames.size());
169 readFields<Type>(values,
fieldNames, cloudObjs);
#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.
void readFields(const typename GeoFieldType::Mesh &mesh, const IOobjectList &objects, const HashSet< word > &selectedFields, LIFOStack< regIOobject *> &storedObjects)
Read the selected GeometricFields of the specified type.
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Ostream & endl(Ostream &os)
Add newline and flush stream.
static List< word > fieldNames
bool fieldOk(const IOobjectList &cloudObjs, const word &name)
tmp< Field< Type > > readParticleField(const word &name, const IOobjectList cloudObjs)
void processFields(OFstream &os, const List< List< label >> &addr, const List< word > &userFieldNames, const IOobjectList &cloudObjs)
errorManip< error > abort(error &err)
void writeVTKFields(OFstream &os, const PtrList< List< Type >> &values, const List< List< label >> &addr, const List< word > &fieldNames)
void writeVTK(OFstream &os, const Type &value)
A class for managing temporary objects.