42 const word& fieldTypeDesc,
50 if (fieldTypeDesc != fieldType::typeName +
"Value")
55 word fieldName(fieldValueStream);
67 if (!fieldHeader.typeHeaderOk<fieldType>(
true))
79 if (fieldHeader.typeHeaderOk<fieldType>(
true))
81 Info<<
" Setting internal values of " 82 << fieldHeader.headerClassName()
83 <<
" " << fieldName <<
endl;
85 fieldType field(fieldHeader, mesh);
89 if (selectedCells.
size() == field.size())
91 field.primitiveFieldRef() = value;
95 forAll(selectedCells, celli)
97 field[selectedCells[celli]] = value;
112 <<
"Failed writing field " << fieldName <<
endl;
118 <<
"Field " << fieldName <<
" not found" <<
endl;
151 selectedCells_(selectedCells)
156 word fieldType(fieldValues);
161 setCellFieldType<scalar>
162 (fieldType, mesh_, selectedCells_, fieldValues)
163 || setCellFieldType<vector>
164 (fieldType, mesh_, selectedCells_, fieldValues)
165 || setCellFieldType<sphericalTensor>
166 (fieldType, mesh_, selectedCells_, fieldValues)
167 || setCellFieldType<symmTensor>
168 (fieldType, mesh_, selectedCells_, fieldValues)
169 || setCellFieldType<tensor>
170 (fieldType, mesh_, selectedCells_, fieldValues)
175 <<
"field type " << fieldType <<
" not currently supported" 186 bool setFaceFieldType
188 const word& fieldTypeDesc,
196 if (fieldTypeDesc != fieldType::typeName +
"Value")
201 word fieldName(fieldValueStream);
213 if (!fieldHeader.typeHeaderOk<fieldType>(
true))
225 if (fieldHeader.typeHeaderOk<fieldType>(
true))
227 Info<<
" Setting patchField values of " 228 << fieldHeader.headerClassName()
229 <<
" " << fieldName <<
endl;
231 fieldType field(fieldHeader, mesh);
243 field.boundaryField()[
patchi].patch().start()
245 ) = field.boundaryField()[
patchi];
249 bool hasWarned =
false;
257 label facei = selectedFaces[i];
264 <<
"Ignoring internal face " << facei
265 <<
". Suppressing further warnings." <<
endl;
271 allBoundaryValues[bFacei] = value;
288 << field.boundaryField()[
patchi].patch().name()
289 <<
" set " << nChanged[
patchi] <<
" values" <<
endl;
294 fieldBf[
patchi].patch().start()
309 <<
"Field " << fieldName <<
" not found" <<
endl;
342 selectedFaces_(selectedFaces)
347 word fieldType(fieldValues);
352 setFaceFieldType<scalar>
353 (fieldType, mesh_, selectedFaces_, fieldValues)
354 || setFaceFieldType<vector>
355 (fieldType, mesh_, selectedFaces_, fieldValues)
356 || setFaceFieldType<sphericalTensor>
357 (fieldType, mesh_, selectedFaces_, fieldValues)
358 || setFaceFieldType<symmTensor>
359 (fieldType, mesh_, selectedFaces_, fieldValues)
360 || setFaceFieldType<tensor>
361 (fieldType, mesh_, selectedFaces_, fieldValues)
366 <<
"field type " << fieldType <<
" not currently supported" 379 int main(
int argc,
char *argv[])
394 if (setFieldsDict.found(
"defaultFieldValues"))
396 Info<<
"Setting field default values" <<
endl;
399 setFieldsDict.lookup(
"defaultFieldValues"),
406 Info<<
"Setting field region values" <<
endl;
412 const entry& region = regions[regionI];
435 setCellField::iNew(mesh, selectedCellSet.
toc())
456 setFaceField::iNew(mesh, selectedFaceSet.
toc())
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
static void listCombineScatter(const List< commsStruct > &comms, List< T > &Value, const int tag, const label comm)
Scatter data. Reverse of combineGather.
#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 keyType & keyword() const
Return keyword.
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
label nInternalFaces() const
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
void size(const label)
Override size to be inconsistent with allocated storage.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const labelList & patchID() const
Per boundary face label the patch index.
virtual const dictionary & dict() const =0
Return dictionary if this entry is a dictionary.
Generic GeometricField class.
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.
Pre-declare related SubField type.
static void listCombineGather(const List< commsStruct > &comms, List< T > &Value, const CombineOp &cop, const int tag, const label comm)
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Pre-declare SubField and related Field type.
A class for handling words, derived from string.
const word & constant() const
Return constant name.
List< label > labelList
A List of labels.
const word dictName("particleTrackDict")
bool isInternalFace(const label faceIndex) const
Return true if given face label is internal to the mesh.
static autoPtr< topoSetSource > New(const word &topoSetSourceType, const polyMesh &mesh, const dictionary &dict)
Return a reference to the selected topoSetSource.
IOobject dictIO(dictName, runTime.constant(), mesh, IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE)
#define WarningInFunction
Report a warning using Foam::Warning.
Boundary & boundaryFieldRef()
Return a reference to the boundary field.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
A collection of cell labels.
Mesh data needed to do the Finite Volume discretisation.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
List< Key > toc() const
Return the table of contents.
label size() const
Return the number of elements in the UList.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
virtual void applyToSet(const setAction action, topoSet &) const =0
A keyword and a list of tokens is an 'entry'.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.