36 bool fieldOk(
const IOobjectList& cloudObjs,
const word& name)
40 return (objects.lookup(name) != NULL);
48 const IOobjectList cloudObjs
53 const IOobject* obj = objects.lookup(name);
56 IOField<Type> newField(*obj);
57 return tmp<Field<Type>>(
new Field<Type>(newField.xfer()));
61 <<
"error: cloud field name " << name <<
" not found" 71 PtrList<List<Type>>& values,
72 const List<word>& fieldNames,
73 const IOobjectList& cloudObjs
80 const IOobject* obj = objects.lookup(fieldNames[j]);
83 Info<<
" reading field " << fieldNames[j] <<
endl;
84 IOField<Type> newField(*obj);
85 values.set(j,
new List<Type>(newField.xfer()));
90 <<
"Unable to read field " << fieldNames[j]
98 void writeVTK(OFstream& os,
const Type& value)
100 os << value.component(0);
101 for (
label i=1; i<pTraits<Type>::nComponents; i++)
103 os <<
' ' << value.component(i);
112 const PtrList<List<Type>>& values,
113 const List<List<label>>& addr,
114 const List<word>& fieldNames
117 label step =
max(floor(8/pTraits<Type>::nComponents), 1);
121 Info<<
" writing field " << fieldNames[fieldi] <<
endl;
122 os << nl << fieldNames[fieldi] << ' ' << pTraits<Type>::nComponents
123 <<
' ' << values[fieldi].size() <<
" float" <<
nl;
127 const List<label> ids(addr[trackI]);
129 List<Type> data(UIndirectList<Type>(values[fieldi], ids));
130 label nData = data.size() - 1;
133 writeVTK<Type>(os, data[i]);
134 if (((i + 1) % step == 0) || (i == nData))
143 offset += ids.size();
153 const List<List<label>>& addr,
154 const List<word>& userFieldNames,
155 const IOobjectList& cloudObjs
165 IOobject* obj = objects.lookup(userFieldNames[i]);
168 fieldNames.append(obj->name());
173 PtrList<List<Type>> values(fieldNames.size());
174 readFields<Type>(values,
fieldNames, cloudObjs);
#define forAll(list, i)
Loop across all elements in list.
bool fieldOk(const IOobjectList &cloudObjs, const word &name)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void processFields(OFstream &os, const List< SortableList< scalar >> &agePerTrack, const List< word > &userFieldNames, const IOobjectList &cloudObjs)
static const char *const typeName
Ostream & endl(Ostream &os)
Add newline and flush stream.
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.
static List< word > fieldNames
tmp< Field< Type > > readParticleField(const word &name, const IOobjectList cloudObjs)
errorManip< error > abort(error &err)
void writeVTKFields(OFstream &os, const PtrList< List< Type >> &values, const List< SortableList< scalar >> &agePerTrack, const List< word > &fieldNames)
static const Field< Type > & null()
Return a null field.
void writeVTK(OFstream &os, const Type &value)