31 #ifndef setCellField_H
32 #define setCellField_H
44 const word& fieldTypeDesc,
55 word fieldName(fieldValueStream);
81 Info<<
" Setting internal values of "
83 <<
" " << fieldName <<
endl;
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"
188 const word& fieldTypeDesc,
203 word fieldName(fieldValueStream);
229 Info<<
" Setting patchField values of "
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)
320 <<
" set " << nonProcPatchNChangedFaces[
patchi]
321 <<
" values" <<
endl;
335 <<
"Field " << fieldName <<
" not found" <<
endl;
368 selectedFaces_(selectedFaces)
373 word fieldType(fieldStream);
378 setFaceFieldType<scalar>
379 (fieldType, mesh_, selectedFaces_, fieldStream)
380 || setFaceFieldType<vector>
381 (fieldType, mesh_, selectedFaces_, fieldStream)
382 || setFaceFieldType<sphericalTensor>
383 (fieldType, mesh_, selectedFaces_, fieldStream)
384 || setFaceFieldType<symmTensor>
385 (fieldType, mesh_, selectedFaces_, fieldStream)
386 || setFaceFieldType<tensor>
387 (fieldType, mesh_, selectedFaces_, fieldStream)
392 <<
"field type " << fieldType <<
" not currently supported"
#define forAll(list, i)
Loop across all elements in list.
Generic GeometricBoundaryField class.
Generic GeometricField class.
const Boundary & boundaryField() const
Return const-reference to the boundary field.
Internal::FieldType & primitiveFieldRef()
Return a reference to the primitive field.
Boundary & boundaryFieldRef()
Return a reference to the boundary field.
const word & headerClassName() const
Return name of the class name read from header.
const word & name() const
Return name.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
static const List< label > & null()
Return a null List.
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.
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...
const word & name() const
Return const reference to name.
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.
virtual bool write(const bool write=true) const
Write using setting from DB.
Templated form of IOobject providing type information for file reading and header type checking.
bool headerOk()
Read header (uses typeGlobalFile to find file) and check.
A class for handling words, derived from string.
static const word null
An empty word.
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
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.
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool setCellFieldType(const word &fieldTypeDesc, const fvMesh &mesh, const labelList &selectedCells, Istream &fieldValueStream)
bool setFaceFieldType(const word &fieldTypeDesc, const fvMesh &mesh, const labelList &selectedFaces, Istream &fieldValueStream)