48 const word& fieldTypeDesc,
59 word fieldName(fieldValueStream);
71 if (!fieldHeader.headerOk())
83 if (fieldHeader.headerOk())
85 Info<<
" Setting internal values of "
86 << fieldHeader.headerClassName()
87 <<
" " << fieldName <<
endl;
93 if (selectedCells.
size() == field.size())
95 field.primitiveFieldRef() = value;
99 forAll(selectedCells, celli)
101 field[selectedCells[celli]] = value;
106 Boundary& fieldBf = field.boundaryFieldRef();
116 <<
"Failed writing field " << fieldName <<
endl;
122 <<
"Field " << fieldName <<
" not found" <<
endl;
155 selectedCells_(selectedCells)
160 word fieldType(fieldValues);
165 setCellFieldType<scalar>
166 (fieldType, mesh_, selectedCells_, fieldValues)
167 || setCellFieldType<vector>
168 (fieldType, mesh_, selectedCells_, fieldValues)
169 || setCellFieldType<sphericalTensor>
170 (fieldType, mesh_, selectedCells_, fieldValues)
171 || setCellFieldType<symmTensor>
172 (fieldType, mesh_, selectedCells_, fieldValues)
173 || setCellFieldType<tensor>
174 (fieldType, mesh_, selectedCells_, fieldValues)
179 <<
"field type " << fieldType <<
" not currently supported"
190 bool setFaceFieldType
192 const word& fieldTypeDesc,
203 word fieldName(fieldValueStream);
215 if (!fieldHeader.headerOk())
227 if (fieldHeader.headerOk())
229 Info<<
" Setting patchField values of "
230 << fieldHeader.headerClassName()
231 <<
" " << fieldName <<
endl;
241 label nNonProcPatches = 0;
248 nNonProcPatches =
patchi + 1;
259 bool haveWarnedInternal =
false, haveWarnedProc =
false;
260 labelList nonProcPatchNChangedFaces(nNonProcPatches, 0);
263 const label facei = selectedFaces[i];
267 if (!haveWarnedInternal)
270 <<
"Ignoring internal face " << facei
271 <<
". Suppressing further warnings." <<
endl;
272 haveWarnedInternal =
true;
284 if (
patches[i] >= nNonProcPatches)
289 <<
"Ignoring face " << patchFaces[i]
290 <<
" of processor patch " <<
patches[i]
291 <<
". Suppressing further warnings." <<
endl;
292 haveWarnedProc =
true;
297 fieldBfCopy[
patches[i]][patchFaces[i]] = value;
298 nonProcPatchNChangedFaces[
patches[i]] ++;
305 nonProcPatchNChangedFaces,
310 nonProcPatchNChangedFaces
316 if (nonProcPatchNChangedFaces[
patchi] > 0)
319 << field.boundaryField()[
patchi].patch().name()
320 <<
" set " << nonProcPatchNChangedFaces[
patchi]
321 <<
" values" <<
endl;
335 <<
"Field " << fieldName <<
" not found" <<
endl;
368 selectedFaces_(selectedFaces)
373 word fieldType(fieldValues);
378 setFaceFieldType<scalar>
379 (fieldType, mesh_, selectedFaces_, fieldValues)
380 || setFaceFieldType<vector>
381 (fieldType, mesh_, selectedFaces_, fieldValues)
382 || setFaceFieldType<sphericalTensor>
383 (fieldType, mesh_, selectedFaces_, fieldValues)
384 || setFaceFieldType<symmTensor>
385 (fieldType, mesh_, selectedFaces_, fieldValues)
386 || setFaceFieldType<tensor>
387 (fieldType, mesh_, selectedFaces_, fieldValues)
392 <<
"field type " << fieldType <<
" not currently supported"
404 int main(
int argc,
char *argv[])
416 if (setFieldsDict.found(
"defaultFieldValues"))
418 Info<<
"Setting field default values" <<
endl;
421 setFieldsDict.lookup(
"defaultFieldValues"),
427 Info<<
"Setting field region values" <<
endl;
433 const entry& region = regions[regionI];
456 setCellField::iNew(mesh, selectedCellSet.toc())
477 setFaceField::iNew(mesh, selectedFaceSet.toc())
#define forAll(list, i)
Loop across all elements in list.
Generic GeometricBoundaryField class.
Generic GeometricField class.
Boundary & boundaryFieldRef()
Return a reference to the boundary field.
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.
static void listCombineGather(const List< commsStruct > &comms, List< T > &Value, const CombineOp &cop, const int tag, const label comm)
static void listCombineScatter(const List< commsStruct > &comms, List< T > &Value, const int tag, const label comm)
Scatter data. Reverse of combineGather.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
static const word & constant()
Return constant name.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
A collection of cell labels.
A list of keyword definitions, which are a keyword followed by any number of values (e....
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
const word & name() const
Return const reference to name.
A keyword and a list of tokens is an 'entry'.
const keyType & keyword() const
Return keyword.
virtual const dictionary & dict() const =0
Return dictionary if this entry is a dictionary.
Mesh data needed to do the Finite Volume discretisation.
const Time & time() const
Return the top-level database.
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.
const UCompactListList< label > & polyBFacePatches() const
Return poly-bFace-patch addressing.
const UCompactListList< label > & polyBFacePatchFaces() const
Return poly-bFace-patch-face addressing.
label nInternalFaces() const
bool isInternalFace(const label faceIndex) const
Return true if given face label is internal to the mesh.
static void addOptions(const bool constant=true, const bool withZero=false)
Add the options handled by timeSelector to argList::validOptions.
static instantList select0(Time &runTime, const argList &args)
Return the set of times selected based on the argList options.
static autoPtr< topoSetSource > New(const word &topoSetSourceType, const polyMesh &mesh, const dictionary &dict)
Return a reference to the selected topoSetSource.
Templated form of IOobject providing type information for file reading and header type checking.
A class for handling words, derived from string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
int main(int argc, char *argv[])
const fvPatchList & patches
#define WarningInFunction
Report a warning using Foam::Warning.
errorManipArg< error, int > exit(error &err, const int errNo=1)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
IOdictionary systemDict(const word &dictName, const argList &args, const objectRegistry &ob, const word ®ionName=polyMesh::defaultRegion)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Foam::argList args(argc, argv)