48 const label oldI = newToOld[i];
52 newElems[i] = elems[oldI];
63 const bitSet& isMasterElem,
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()
123 const polyBoundaryMesh&
patches = mesh_.boundaryMesh();
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;
144 <<
" fc:" << mesh_.faceCentres()[facei]
145 <<
" patch:" <<
pp.name()
146 <<
" faceData:" << data
147 <<
" syncedFaceData:" << syncData
148 <<
" diff:" <<
mag(data - syncData)
176 for (
const label allPointi : visitOrder)
184 template<
class GeoField>
185 void 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);
213 template<
class GeoField>
214 void Foam::meshRefinement::reorderPatchFields
221 for (GeoField&
fld :
mesh.objectRegistry::objects<GeoField>())
223 fld.boundaryFieldRef().reorder(oldToNew);
228 template<
class EnumContainer>
231 const EnumContainer& namedEnum,
237 for (
const word& w : words)
239 flags |= namedEnum[w];
250 const bitSet& isMasterEdge,
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];
327 <<
"Entry '" << keyword <<
"' not found in dictionary "
void size(const label n)
Older name for setAddressableSize.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &f1)
errorManipArg< error, int > exit(error &err, const int errNo=1)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
void transfer(List< T > &list)
Transfer the contents of the argument List into this list and annul the argument list.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
labelList sortedOrder(const UList< T > &input)
Return the (stable) sort order for the list.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
constexpr char nl
The newline '\n' character (0x0a)
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.
Ostream & endl(Ostream &os)
Add newline and flush stream.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
const fileName & name() const noexcept
The dictionary name.
#define forAll(list, i)
Loop across all elements in list.
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, IOobjectOption::readOption readOpt=IOobjectOption::MUST_READ) const
Find entry and assign to T val. FatalIOError if it is found and the number of tokens is incorrect...
List< T > values(const HashTable< T, Key, Hash > &tbl, const bool doSort=false)
List of values from HashTable, optionally sorted.
static void updateList(const labelList &newToOld, const T &nullValue, List< T > &elems)
Helper: reorder list according to map.
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
const dimensionedScalar e
Elementary charge.
A class for handling words, derived from Foam::string.
Reading is optional [identical to LAZY_READ].
void testSyncBoundaryFaceList(const scalar mergeDistance, const string &, const UList< T > &, const UList< T > &) const
Compare two lists over all boundary faces.
errorManip< error > abort(error &err)
bool test(const label pos) const
Test for True value at specified position, never auto-vivify entries.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
static int readFlags(const EnumContainer &namedEnum, const wordList &words)
Helper: convert wordList into bit pattern using provided Enum.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< ' ';}gmvFile<< nl;for(const word &name :lagrangianScalarNames){ IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
List< word > wordList
List of word.
Calculates points shared by more than two processor patches or cyclic patches.
static void collectAndPrint(const UList< point > &points, const UList< T > &data)
Print list according to (collected and) sorted coordinate.
vector point
Point is a vector.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
const polyBoundaryMesh & patches
option
Enumeration for the data type and search/match modes (bitmask)
messageStream Info
Information stream (stdout output on master, null elsewhere)
const fvBoundaryMesh & boundary() const noexcept
Return reference to boundary mesh.
Mesh consisting of general polyhedral cells.
List< label > labelList
A List of labels.
static T gAverage(const bitSet &isMasterElem, const UList< T > &values)
Helper: calculate average.
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.
label size() const noexcept
Number of entries.
void reduce(T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce) using linear/tree communication schedule.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
static constexpr const zero Zero
Global zero (0)
readOption
Enumeration defining read preferences.