45 const word& fieldTypeDesc,
53 if (fieldTypeDesc != fieldType::typeName +
"Value")
58 word fieldName(fieldValueStream);
70 if (!fieldHeader.typeHeaderOk<fieldType>(
true))
82 if (fieldHeader.typeHeaderOk<fieldType>(
true))
84 Info<<
" Setting internal values of " 85 << fieldHeader.headerClassName()
86 <<
" " << fieldName <<
endl;
88 fieldType
field(fieldHeader, mesh);
94 field.primitiveFieldRef() = value;
98 forAll(selectedCells, celli)
100 field[selectedCells[celli]] = value;
105 Boundary& fieldBf =
field.boundaryFieldRef();
115 <<
"Failed writing field " << fieldName <<
endl;
121 <<
"Field " << fieldName <<
" not found" <<
endl;
154 selectedCells_(selectedCells)
159 word fieldType(fieldValues);
164 setCellFieldType<scalar>
165 (fieldType, mesh_, selectedCells_, fieldValues)
166 || setCellFieldType<vector>
167 (fieldType, mesh_, selectedCells_, fieldValues)
168 || setCellFieldType<sphericalTensor>
169 (fieldType, mesh_, selectedCells_, fieldValues)
170 || setCellFieldType<symmTensor>
171 (fieldType, mesh_, selectedCells_, fieldValues)
172 || setCellFieldType<tensor>
173 (fieldType, mesh_, selectedCells_, fieldValues)
178 <<
"field type " << fieldType <<
" not currently supported" 189 bool setFaceFieldType
191 const word& fieldTypeDesc,
199 if (fieldTypeDesc != fieldType::typeName +
"Value")
204 word fieldName(fieldValueStream);
216 if (!fieldHeader.typeHeaderOk<fieldType>(
true))
228 if (fieldHeader.typeHeaderOk<fieldType>(
true))
230 Info<<
" Setting patchField values of " 231 << fieldHeader.headerClassName()
232 <<
" " << fieldName <<
endl;
234 fieldType
field(fieldHeader, mesh);
252 bool hasWarned =
false;
260 label facei = selectedFaces[i];
267 <<
"Ignoring internal face " << facei
268 <<
". Suppressing further warnings." <<
endl;
274 allBoundaryValues[bFacei] = value;
283 Boundary& fieldBf =
field.boundaryFieldRef();
292 <<
" set " << nChanged[
patchi] <<
" values" <<
endl;
297 fieldBf[
patchi].patch().start()
312 <<
"Field " << fieldName <<
" not found" <<
endl;
345 selectedFaces_(selectedFaces)
350 word fieldType(fieldValues);
355 setFaceFieldType<scalar>
356 (fieldType, mesh_, selectedFaces_, fieldValues)
357 || setFaceFieldType<vector>
358 (fieldType, mesh_, selectedFaces_, fieldValues)
359 || setFaceFieldType<sphericalTensor>
360 (fieldType, mesh_, selectedFaces_, fieldValues)
361 || setFaceFieldType<symmTensor>
362 (fieldType, mesh_, selectedFaces_, fieldValues)
363 || setFaceFieldType<tensor>
364 (fieldType, mesh_, selectedFaces_, fieldValues)
369 <<
"field type " << fieldType <<
" not currently supported" 381 int main(
int argc,
char *argv[])
391 if (setFieldsDict.found(
"defaultFieldValues"))
393 Info<<
"Setting field default values" <<
endl;
396 setFieldsDict.lookup(
"defaultFieldValues"),
402 Info<<
"Setting field region values" <<
endl;
408 const entry& region = regions[regionI];
431 setCellField::iNew(mesh, selectedCellSet.
toc())
452 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)
A list of keyword definitions, which are a keyword followed by any number of values (e...
#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.
IOdictionary systemDict(const word &dictName, const argList &args, const objectRegistry &ob, const word ®ionName=polyMesh::defaultRegion)
static void listCombineGather(const List< commsStruct > &comms, List< T > &Value, const CombineOp &cop, const int tag, const label comm)
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.
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.
fvModels source(alpha1, mixture.thermo1().rho())
#define WarningInFunction
Report a warning using Foam::Warning.
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.
Foam::argList args(argc, argv)
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.