48 const label oldI = newToOld[i];
52 newElems[i] = elems[oldI];
63 const bitSet& isMasterElem,
64 const UList<T>& values
67 if (values.size() != isMasterElem.size())
70 <<
"Number of elements in list " << values.size()
71 <<
" does not correspond to number of elements in isMasterElem "
72 << isMasterElem.size()
81 if (isMasterElem.test(i))
108 const UList<T>& faceData,
109 const UList<T>& syncedFaceData
112 const label nBFaces = mesh_.nBoundaryFaces();
114 if (faceData.size() != nBFaces || syncedFaceData.size() != nBFaces)
117 <<
"Boundary faces:" << nBFaces
118 <<
" faceData:" << faceData.size()
119 <<
" syncedFaceData:" << syncedFaceData.size()
129 label bFacei =
pp.start() - mesh_.nInternalFaces();
133 const T& data = faceData[bFacei];
134 const T& syncData = syncedFaceData[bFacei];
136 if (
mag(data - syncData) > tol)
138 label facei =
pp.start()+i;
145 <<
" patch:" <<
pp.name()
146 <<
" faceData:" << data
147 <<
" syncedFaceData:" << syncData
148 <<
" diff:" <<
mag(data - syncData)
163 const UList<point>&
points,
167 const globalIndex globalPoints(
points.size());
170 List<T> allData(globalPoints.gather(data));
176 for (
const label allPointi : visitOrder)
178 Info<< allPoints[allPointi] <<
" : " << allData[allPointi]
184template<
class GeoField>
185void Foam::meshRefinement::addPatchFields
188 const word& patchFieldType
192 for (GeoField&
fld :
mesh.objectRegistry::objects<GeoField>())
194 auto& bfld =
fld.boundaryFieldRef();
196 const label newPatchi = bfld.size();
197 bfld.resize(newPatchi+1);
213template<
class GeoField>
214void Foam::meshRefinement::reorderPatchFields
221 for (GeoField&
fld :
mesh.objectRegistry::objects<GeoField>())
223 fld.boundaryFieldRef().reorder(oldToNew);
228template<
class EnumContainer>
231 const EnumContainer& namedEnum,
237 for (
const word& w : words)
239 flags |= namedEnum[w];
249 const polyMesh&
mesh,
250 const bitSet& isMasterEdge,
254 const Field<Type>& pointData,
260 edges.size() != isMasterEdge.size()
261 || edges.size() != edgeWeights.size()
262 || meshPoints.size() != pointData.size()
266 <<
"Inconsistent sizes for edge or point data:"
267 <<
" isMasterEdge:" << isMasterEdge.size()
268 <<
" edgeWeights:" << edgeWeights.size()
269 <<
" edges:" << edges.size()
270 <<
" pointData:" << pointData.size()
271 <<
" meshPoints:" << meshPoints.size()
275 sum.setSize(meshPoints.size());
280 if (isMasterEdge.test(edgeI))
282 const edge&
e = edges[edgeI];
284 scalar eWeight = edgeWeights[edgeI];
289 sum[v0] += eWeight*pointData[v1];
290 sum[v1] += eWeight*pointData[v0];
324 if (!
dict.readEntry(keyword, val, matchOpt, readOpt))
327 <<
"Entry '" << keyword <<
"' not found in dictionary "
Info<< nl;Info<< "Write faMesh in vtk format:"<< nl;{ vtk::uindirectPatchWriter writer(aMesh.patch(), fileName(aMesh.time().globalPath()/vtkBaseFileName));writer.writeGeometry();globalIndex procAddr(aMesh.nFaces());labelList cellIDs;if(UPstream::master()) { cellIDs.resize(procAddr.totalSize());for(const labelRange &range :procAddr.ranges()) { auto slice=cellIDs.slice(range);slice=identity(range);} } writer.beginCellData(4);writer.writeProcIDs();writer.write("cellID", cellIDs);writer.write("area", aMesh.S().field());writer.write("normal", aMesh.faceAreaNormals());writer.beginPointData(1);writer.write("normal", aMesh.pointAreaNormals());Info<< " "<< writer.output().name()<< nl;}{ vtk::lineWriter writer(aMesh.points(), aMesh.edges(), fileName(aMesh.time().globalPath()/(vtkBaseFileName+"-edges")));writer.writeGeometry();writer.beginCellData(4);writer.writeProcIDs();{ Field< scalar > fld(faMeshTools::flattenEdgeField(aMesh.magLe(), true))
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
readOption
Enumeration defining read preferences.
@ READ_IF_PRESENT
Reading is optional [identical to LAZY_READ].
@ MUST_READ
Reading required.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void transfer(List< T > &list)
Transfer the contents of the argument List into this list and annul the argument list.
label size() const noexcept
Number of entries.
const Field< point_type > & faceCentres() const
Return face centres for patch.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
void size(const label n)
Older name for setAddressableSize.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
bool test(const label pos) const
Test for True value at specified position, never auto-vivify entries.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
An edge is a list of two vertex labels. This can correspond to a directed graph edge or an edge on a ...
Mesh data needed to do the Finite Volume discretisation.
const fvBoundaryMesh & boundary() const noexcept
Return reference to boundary mesh.
Calculates a non-overlapping list of offsets based on an input size (eg, number of cells) from differ...
Calculates points shared by more than two processor patches or cyclic patches.
option
Enumeration for the data type and search/match modes (bitmask).
static T gAverage(const bitSet &isMasterElem, const UList< T > &values)
Helper: calculate average.
static void collectAndPrint(const UList< point > &points, const UList< T > &data)
Print list according to (collected and) sorted coordinate.
static Type get(const dictionary &dict, const word &keyword, const bool noExit, enum keyType::option matchOpt=keyType::REGEX, const Type &deflt=Zero)
Wrapper around dictionary::get which does not exit.
static int readFlags(const EnumContainer &namedEnum, const wordList &words)
Helper: convert wordList into bit pattern using provided Enum.
static void weightedSum(const polyMesh &mesh, const bitSet &isMasterEdge, const labelList &meshPoints, const edgeList &edges, const scalarField &edgeWeights, const Field< Type > &data, Field< Type > &sum)
Helper: weighted sum (over all subset of mesh points) by.
const fvMesh & mesh() const
Reference to mesh.
void testSyncBoundaryFaceList(const scalar mergeDistance, const string &, const UList< T > &, const UList< T > &) const
Compare two lists over all boundary faces.
static void updateList(const labelList &newToOld, const T &nullValue, List< T > &elems)
Helper: reorder list according to map.
A traits class, which is primarily used for primitives and vector-space.
A polyBoundaryMesh is a polyPatch list with registered IO, a reference to the associated polyMesh,...
Mesh consisting of general polyhedral cells.
A patch is a list of labels that address the faces in the global face list.
A class for handling words, derived from Foam::string.
const polyBoundaryMesh & patches
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
List< T > values(const HashTable< T, Key, Hash > &tbl, const bool doSort=false)
List of values from HashTable, optionally sorted.
List< edge > edgeList
List of edge.
List< word > wordList
List of word.
List< label > labelList
A List of labels.
messageStream Info
Information stream (stdout output on master, null elsewhere).
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
labelList sortedOrder(const UList< T > &input)
Return the (stable) sort order for the list.
void reduce(T &value, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce).
errorManip< error > abort(error &err)
vector point
Point is a vector.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &f1, const label comm)
static constexpr const zero Zero
Global zero (0).
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
vectorField pointField
pointField is a vectorField.
errorManipArg< error, int > exit(error &err, const int errNo=1)
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
constexpr char nl
The newline '\n' character (0x0a).
#define forAll(list, i)
Loop across all elements in list.