78 const NamedEnum<LagrangianMesh::partitioningAlgorithm, 2>
95 void Foam::LagrangianMesh::printGroups(
const bool header)
const
97 checkPtr(offsetsPtr_,
"Offsets");
101 static const label completei =
103 static const label inInternalMeshi =
105 static const label onPatchZeroi =
109 label nNonProcPatches = 0;
110 for (; nNonProcPatches <
boundary().
size(); ++ nNonProcPatches)
112 const LagrangianPatch&
p =
boundary()[nNonProcPatches];
114 if (isA<processorLagrangianPatch>(
p))
break;
119 bool hasProcPatches =
false;
120 boolList patchIsReferred(nNonProcPatches,
false);
125 if (isA<processorCyclicLagrangianPatch>(
p))
129 refCast<const processorCyclicLagrangianPatch>(
p)
135 hasProcPatches =
true;
138 reduce(hasProcPatches, orOp<bool>());
144 const labelList patchReferred(
invert(nNonProcPatches, referredPatches));
148 const label onProcPatchi = onPatchZeroi + nNonProcPatches;
149 const label onProcCyclicPatchZeroi = onProcPatchi + hasProcPatches;
150 const label toBeRemovedi = onProcCyclicPatchZeroi + referredPatches.size();
153 wordList columnNames(toBeRemovedi + 1);
158 columnNames[onPatchZeroi +
patchi] =
166 columnNames[onProcPatchi] =
"(processor)";
168 forAll(referredPatches, referredPatchi)
170 columnNames[onProcCyclicPatchZeroi + referredPatchi] =
172 +
boundary()[referredPatches[referredPatchi]].name();
181 if (i && columnNames[i].
size())
Info<<
' ';
183 Info<< columnNames[i];
190 labelList columnNumbers(toBeRemovedi + 1, 0);
191 columnNumbers[completei] = offsets[completei + 1] - offsets[completei];
192 columnNumbers[inInternalMeshi] =
193 offsets[inInternalMeshi + 1] - offsets[inInternalMeshi];
196 columnNumbers[onPatchZeroi +
patchi] =
197 offsets[onPatchZeroi +
patchi + 1] - offsets[onPatchZeroi +
patchi];
203 if (isA<processorCyclicLagrangianPatch>(
p))
209 refCast<const processorCyclicLagrangianPatch>(
p)
213 offsets[onPatchZeroi +
patchi + 1]
214 - offsets[onPatchZeroi +
patchi];
218 columnNumbers[onProcPatchi] +=
219 offsets[onPatchZeroi +
patchi + 1]
220 - offsets[onPatchZeroi +
patchi];
229 if (i && columnNames[i].
size())
Info<<
' ';
234 if (columnNumberDigits > columnNames[i].
size())
236 Info << string(columnNames[i].
size(),
'#').c_str();
240 Info <<
setw(columnNames[i].
size()) << columnNumbers[i];
254 const label i0 = offsets[1];
258 for (
label i = i0; i < states.size(); ++ i)
260 const label groupi = stateToGroupi(states[i]);
261 offsets[groupi + 1] ++;
267 for (
label groupi = 0; groupi < nGroups(); ++ groupi)
269 offsets[groupi + 1] += offsets[groupi];
274 labelList permutation(states.size() - i0);
275 for (
label i = i0; i < states.size(); ++ i)
277 const label groupi = stateToGroupi(states[i]);
278 permutation[offsets[groupi] - i0] = i;
285 for (
label groupi = nGroups(); groupi > 0; -- groupi)
287 offsets[groupi] = offsets[groupi - 1];
304 const label i0 = offsets[1];
309 offsets[nGroups()] = states.size();
312 labelList permutation(states.size() - i0);
315 permutation[i] = i + i0;
319 label nIterations = 0;
320 for (
label groupi = 1; groupi < nGroups(); groupi *= 2)
326 label nDivisions = 1;
327 for (
label iterationi = 0; iterationi < nIterations; ++ iterationi)
329 for (
label divisioni = 0; divisioni < nDivisions; ++ divisioni)
331 const label pivot = (2*divisioni + 1)*nGroups()/(2*nDivisions);
332 if (offsets[pivot] != -1)
337 const label pivot0 = divisioni*nGroups()/nDivisions;
338 const label pivot1 = (divisioni + 1)*nGroups()/nDivisions;
339 label i = offsets[pivot0] - i0, j = offsets[pivot1] - i0;
345 && stateToGroupi(states[permutation[i]]) < pivot
353 && stateToGroupi(states[permutation[j - 1]]) >= pivot
360 Swap(permutation[i], permutation[j - 1]);
364 offsets[pivot] = i + i0;
378 void Foam::LagrangianMesh::permuteAndResizeFields(
const labelList& permutation)
381 #define PERMUTE_TYPE_FIELDS(Type, GeoField) \
383 HashTable<GeoField<Type>*> fields \
385 lookupCurrentFields<GeoField<Type>>() \
388 forAllIter(typename HashTable<GeoField<Type>*>, fields, iter) \
390 if (permutedFieldNames.found(iter()->name())) continue; \
392 permutedFieldNames.insert(iter()->name()); \
394 permuteList(permutation, iter()->primitiveFieldRef()); \
396 resizeContainer(iter()->primitiveFieldRef()); \
407 #undef PERMUTE_TYPE_FIELDS
412 void Foam::LagrangianMesh::permuteList
418 switch (permutationAlgorithm_)
420 case permutationAlgorithm::copy:
421 permuteListCopy(permutation, list);
424 case permutationAlgorithm::inPlace:
425 permuteListInPlace(permutation, list);
432 void Foam::LagrangianMesh::permuteListCopy
438 if (permutation.empty())
return;
440 const label i0 = list.size() - permutation.size();
442 SubList<Type>(list, permutation.size(), i0) =
443 List<Type>(UIndirectList<Type>(list, permutation));
448 void Foam::LagrangianMesh::permuteListInPlace
454 if (permutation.empty())
return;
456 const label i0 = list.size() - permutation.size();
461 Type t = list[i + i0];
463 forAll(permutation, permutationi)
465 bool end = permutationRef[i] < 0;
467 while (permutationRef[i] < 0) ++ i;
469 if (end) t = list[i + i0];
476 permutationRef[permutationRef[i] - i0] < 0
477 ? t : list[permutationRef[i]];
479 permutationRef[i] = - permutationRef[i] - 1;
480 i = - permutationRef[i] - 1 - i0;
483 forAll(permutationRef, permutationi)
485 permutationRef[permutationi] = - permutationRef[permutationi] - 1;
490 template<
class Container>
491 void Foam::LagrangianMesh::resizeContainer(Container& container)
const
493 container.resize(offsetsPtr_->last());
503 void Foam::LagrangianMesh::append
505 const LagrangianSubMesh& appendMesh,
514 if (statesPtr_.valid())
519 if (receivePatchFacePtr_.valid())
521 receivePatchFacePtr_().resize(appendMesh.end(),
label(-1));
524 if (receivePositionPtr_.valid())
526 receivePositionPtr_().resize(appendMesh.end(),
point::nan);
530 celli_.append(celli);
531 facei_.append(facei);
532 faceTrii_.append(faceTrii);
534 subAll_.size_ = size();
546 const LagrangianSubMesh appendMesh
554 append(appendMesh,
coordinates, celli, facei, faceTrii);
560 void Foam::LagrangianMesh::append
562 const LagrangianSubMesh& appendMesh,
568 if (statesPtr_.valid())
570 states().resize(appendMesh.end());
572 UIndirectList<LagrangianState>(states(), parents)();
575 if (receivePatchFacePtr_.valid())
577 receivePatchFacePtr_().resize(appendMesh.end());
578 appendMesh.sub(
static_cast<List<label>&
>(receivePatchFacePtr_())) =
579 UIndirectList<label>(receivePatchFacePtr_(), parents)();
582 if (receivePositionPtr_.valid())
584 receivePositionPtr_().resize(appendMesh.end());
585 appendMesh.sub(
static_cast<List<point>&
>(receivePositionPtr_())) =
586 UIndirectList<point>(receivePositionPtr_(), parents)();
589 coordinates_.resize(appendMesh.end());
591 UIndirectList<barycentric>(coordinates_, parents)();
592 celli_.resize(appendMesh.end());
593 appendMesh.sub(
static_cast<labelList&
>(celli_)) =
594 UIndirectList<label>(celli_, parents)();
595 facei_.resize(appendMesh.end());
596 appendMesh.sub(
static_cast<labelList&
>(facei_)) =
597 UIndirectList<label>(facei_, parents)();
598 faceTrii_.resize(appendMesh.end());
599 appendMesh.sub(
static_cast<labelList&
>(faceTrii_)) =
600 UIndirectList<label>(faceTrii_, parents)();
602 subAll_.size_ = size();
611 const LagrangianSubMesh appendMesh
619 append(appendMesh, parents);
627 const LagrangianSubMesh&
634 void Foam::LagrangianMesh::injectUnspecifiedFields
636 const LagrangianInjection& injection,
637 const LagrangianSubMesh& injectionMesh,
643 #define INJECT_TYPE_FIELDS(Type, GeoField) \
645 HashTable<GeoField<Type>*> fields \
647 lookupCurrentFields<GeoField<Type>>() \
650 forAllIter(typename HashTable<GeoField<Type>*>, fields, iter) \
652 if (specifiedFieldNames.found(iter()->name())) continue; \
654 injectedFieldNames.insert(iter()->name()); \
657 iter()->resize(injectionMesh.end()); \
660 injectionMesh.sub(*iter()).ref() = \
661 iter()->sources()[injection.name()].value \
672 #undef INJECT_TYPE_FIELDS
675 #define INJECT_STATE_FIELD(GeoField) \
677 if (foundObject<GeoField<label>>(stateName)) \
679 GeoField<label>& state = \
680 lookupObjectRef<GeoField<label>>(stateName); \
682 injectedFieldNames.insert(stateName); \
685 state.resize(injectionMesh.end()); \
688 injectionMesh.sub(state).ref() = \
689 static_cast<label>(LagrangianState::none); \
694 #undef INJECT_STATE_FIELD
698 #define INSERT_INTERNAL_FIELD_NAMES(Type, GeoField) \
700 HashTable<GeoField<Type>*> fields \
702 lookupCurrentFields<GeoField<Type>>() \
705 forAllIter(typename HashTable<GeoField<Type>*>, fields, iter) \
707 if (specifiedFieldNames.found(iter()->name())) continue; \
708 if (injectedFieldNames.found(iter()->name())) continue; \
710 internalFieldNames.insert(iter()->name()); \
721 #undef INSERT_INTERNAL_FIELD_NAMES
723 if (!internalFieldNames.empty())
726 <<
"Internal fields " << internalFieldNames.sortedToc() <<
" are "
727 <<
"registered during an injection event. These fields do not "
728 <<
"contain source conditions so their new values cannot be "
729 <<
"assigned. Either specify these fields' values in the calling "
730 <<
"code, or ensure that they are not registered."
736 void Foam::LagrangianMesh::injectUnspecifiedFields
738 const LagrangianSubMesh& injectionMesh,
743 #define INSERT_FIELD_NAMES(Type, GeoField) \
744 fieldNames.insert(lookupCurrentFields<GeoField<Type>>().toc());
753 #undef INSERT_FIELD_NAMES
758 <<
"Fields " <<
fieldNames.sortedToc() <<
" are registered during "
759 <<
"an injection event. These fields' new values cannot be "
760 <<
"assigned. Either specify these fields' values in the calling "
761 <<
"code, or ensure that they are not registered."
767 void Foam::LagrangianMesh::birthUnspecifiedFields
770 const LagrangianSubMesh& birthMesh,
775 #define BIRTH_TYPE_FIELDS(Type, GeoField) \
777 HashTable<GeoField<Type>*> fields \
779 lookupCurrentFields<GeoField<Type>>() \
782 forAllIter(typename HashTable<GeoField<Type>*>, fields, iter) \
784 if (specifiedFieldNames.found(iter()->name())) continue; \
785 if (birthedFieldNames.found(iter()->name())) continue; \
787 birthedFieldNames.insert(iter()->name()); \
790 iter()->resize(birthMesh.end()); \
793 birthMesh.sub(*iter()).ref().primitiveFieldRef() = \
794 Field<Type>(UIndirectList<Type>(*iter(), parents)()); \
805 #undef BIRTH_TYPE_FIELDS
809 void Foam::LagrangianMesh::changer::constructNonConformal()
const
811 bool haveNccPatches =
false;
815 const polyPatch& pp = mesh_.poly().boundary()[
patchi];
817 if (isA<nonConformalCyclicPolyPatch>(pp))
819 haveNccPatches =
true;
824 if (!haveNccPatches)
return;
826 mesh_.origPatchNccPatchisPtr_.set
830 mesh_.boundary().size(),
834 mesh_.origPatchNccPatchesPtr_.set
836 new List<UPtrList<const nonConformalCyclicPolyPatch>>
838 mesh_.boundary().size(),
839 UPtrList<const nonConformalCyclicPolyPatch>()
842 mesh_.nccPatchProcNccPatchisPtr_.set
846 mesh_.boundary().size(),
853 const polyPatch& pp = mesh_.poly().boundary()[
patchi];
855 if (isA<nonConformalCyclicPolyPatch>(pp))
857 const nonConformalCyclicPolyPatch& nccPp =
858 refCast<const nonConformalCyclicPolyPatch>(pp);
860 mesh_.origPatchNccPatchisPtr_()
861 [nccPp.origPatchIndex()].append(
patchi);
862 mesh_.origPatchNccPatchesPtr_()
863 [nccPp.origPatchIndex()].append(&nccPp);
865 mesh_.nccPatchProcNccPatchisPtr_()
869 if (nccPp.owner()) nccPp.rays();
871 else if (isA<nonConformalProcessorCyclicPolyPatch>(pp))
873 const nonConformalProcessorCyclicPolyPatch& ncpcPp =
874 refCast<const nonConformalProcessorCyclicPolyPatch>(pp);
876 mesh_.nccPatchProcNccPatchisPtr_()
877 [ncpcPp.referPatchIndex()][ncpcPp.neighbProcNo()] =
882 mesh_.receivePatchFacePtr_.set
884 new DynamicList<label>(mesh_.size(),
label(-1))
887 mesh_.receivePositionPtr_.set
889 new DynamicList<point>(mesh_.size(),
point::nan)
894 void Foam::LagrangianMesh::changer::constructBehind()
const
896 mesh_.fractionBehindPtr_.set
898 new LagrangianDynamicField<scalar>
902 fractionName +
"Behind",
909 dimensioned<scalar>(
dimless, scalar(0)),
912 mesh_.boundary().size(),
919 zeroLagrangianScalarFieldSource,
921 internalLagrangianScalarFieldSource
926 mesh_.nTracksBehindPtr_.set
928 new LagrangianDynamicField<label>
942 mesh_.boundary().size(),
949 zeroLagrangianLabelFieldSource,
951 internalLagrangianLabelFieldSource
1057 statesPtr_(nullptr),
1058 offsetsPtr_(nullptr),
1060 schemesPtr_(nullptr)
1064 checkFieldSize(coordinates_);
1065 checkFieldSize(celli_);
1069 if (!celli_.empty() && facei_.empty())
1083 if (!cellFacei.
empty())
1085 checkFieldSize(cellFacei);
1086 facei_.resize(cellFacei.
size());
1089 facei_[i] = mesh_.
cells()[celli_[i]][cellFacei[i]];
1094 checkFieldSize(facei_);
1095 checkFieldSize(faceTrii_);
1116 mesh_.statesPtr_.set
1121 mesh_.offsetsPtr_.set
1133 mesh_.offsetsPtr_()[groupi] = mesh_.
size();
1136 constructNonConformal();
1139 mesh_.printGroups(
true);
1141 mesh_.printGroups(
false);
1161 mesh_.statesPtr_.set
1166 mesh_.offsetsPtr_.set
1171 constructNonConformal();
1174 mesh_.printGroups(
true);
1190 mesh_.statesPtr_.
clear();
1191 mesh_.offsetsPtr_.
clear();
1193 mesh_.origPatchNccPatchisPtr_.
clear();
1194 mesh_.origPatchNccPatchesPtr_.
clear();
1195 mesh_.nccPatchProcNccPatchisPtr_.
clear();
1196 mesh_.receivePatchFacePtr_.
clear();
1197 mesh_.receivePositionPtr_.
clear();
1199 mesh_.fractionBehindPtr_.
clear();
1200 mesh_.nTracksBehindPtr_.
clear();
1225 quadratic_(quadratic)
1233 if (!schemesPtr_.valid())
1238 return schemesPtr_();
1244 if (!solutionPtr_.valid())
1249 return solutionPtr_();
1261 if (isA<processorPolyPatch>(pp))
break;
1268 static const label completei =
1270 static const label inInternalMeshi =
1272 static const label onPatchZeroi =
1282 if (isA<processorPolyPatch>(pp))
break;
1296 for (
label i = 0; i < nGlobalGroups - 1; ++ i)
1298 result[i] = sizes[i];
1357 coordinates_[i], celli_[i], facei_[i], faceTrii_[i], 1
1420 procCelli[i].proci =
1455 checkPtr(offsetsPtr_,
"Offsets");
1463 permutation = partitionBin(offsets,
states());
1467 permutation = partitionQuick(offsets,
states());
1477 permuteList(permutation,
states());
1478 permuteList(permutation, coordinates_);
1479 permuteList(permutation, celli_);
1480 permuteList(permutation, facei_);
1481 permuteList(permutation, faceTrii_);
1484 if (receivePatchFacePtr_.valid())
1486 permuteList(permutation, receivePatchFacePtr_());
1488 if (receivePositionPtr_.valid())
1490 permuteList(permutation, receivePositionPtr_());
1497 for (
label i = offsets[groupi]; i < offsets[groupi + 1]; ++ i)
1502 <<
"Partitioning failed"
1513 resizeContainer(
states());
1514 resizeContainer(coordinates_);
1515 resizeContainer(celli_);
1516 resizeContainer(facei_);
1517 resizeContainer(faceTrii_);
1520 if (receivePatchFacePtr_.valid())
1522 resizeContainer(receivePatchFacePtr_());
1524 if (receivePositionPtr_.valid())
1526 resizeContainer(receivePositionPtr_());
1530 permuteAndResizeFields(permutation);
1539 subAll_.size_ =
size();
1543 template<
class Displacement>
1547 const Displacement& displacement,
1567 mesh_, displacement(subi), deltaFraction[subi],
1568 coordinates_[i], celli_[i], facei_[i], faceTrii_[i],
1570 fractionBehindPtr_()[i], nTracksBehindPtr_()[i],
1573 : NullObjectRef<string>()
1577 if (!onFaceAndF.
first())
1579 states()[i] = endState[subi];
1599 origPatchNccPatchisPtr_.valid()
1604 const point sendPosition =
1608 coordinates_[i], celli_[i], facei_[i], faceTrii_[i],
1613 const vector sendDisplacement =
1617 coordinates_[i], celli_[i], facei_[i], faceTrii_[i],
1622 forAll(origPatchNccPatchisPtr_()[
patchi], patchNccPatchi)
1624 const label nccPatchi =
1625 origPatchNccPatchisPtr_()[
patchi][patchNccPatchi];
1627 origPatchNccPatchesPtr_()[
patchi][patchNccPatchi];
1629 point receivePosition;
1630 const remote receiveProcAndFace =
1636 displacement(subi, onFaceAndF.
second())
1641 const label receiveProci = receiveProcAndFace.
proci;
1643 if (receiveProci == -1)
continue;
1647 receivePatchFacePtr_()[i] = receiveFacei;
1648 receivePositionPtr_()[i] = receivePosition;
1651 nccPatchProcNccPatchisPtr_()[nccPatchi][receiveProci];
1670 void Foam::LagrangianMesh::track<Foam::LagrangianMesh::linearDisplacement>
1673 const linearDisplacement& displacement,
1680 void Foam::LagrangianMesh::track<Foam::LagrangianMesh::parabolicDisplacement>
1683 const parabolicDisplacement& displacement,
1702 forAll(incompleteMesh, subi)
1704 const label i = subi + incompleteMesh.
start();
1712 coordinates_[i], celli_[i], facei_[i], faceTrii_[i]
1735 #define INIT_EVAL_TYPE_PATCH_FIELDS(Type, GeoField) \
1737 HashTable<GeoField<Type>*> fields \
1739 lookupCurrentFields<GeoField<Type>>() \
1742 forAllIter(typename HashTable<GeoField<Type>*>, fields, iter) \
1744 forAll(boundary(), patchi) \
1746 iter()->boundaryFieldRef()[patchi].initEvaluate \
1758 #undef INIT_EVAL_TYPE_PATCH_FIELDS
1770 #define EVAL_TYPE_PATCH_FIELDS(Type, GeoField) \
1772 HashTable<GeoField<Type>*> fields \
1774 lookupCurrentFields<GeoField<Type>>() \
1777 forAllIter(typename HashTable<GeoField<Type>*>, fields, iter) \
1779 forAll(boundary(), patchi) \
1781 iter()->boundaryFieldRef()[patchi].evaluate \
1793 #undef EVAL_TYPE_PATCH_FIELDS
1798 <<
"Unsupported communications type "
1807 return appendMesh(
n);
1813 return appendMesh(
n);
1821 if (initial &&
final)
return;
1834 #define OLD_TIME_TYPE_FIELDS(Type, GeoField) \
1836 HashTable<GeoField<Type>*> fields \
1838 lookupCurrentFields<GeoField<Type>>() \
1841 forAllIter(typename HashTable<GeoField<Type>*>, fields, iter) \
1843 iter()->storeOldTimes(); \
1844 iter()->oldTime(); \
1849 #undef OLD_TIME_TYPE_FIELDS
1860 #define RESET_OLD_TIME_TYPE_FIELDS(Type, GeoField) \
1862 HashTable<GeoField<Type>*> fields \
1864 lookupCurrentFields<GeoField<Type>>() \
1867 forAllIter(typename HashTable<GeoField<Type>*>, fields, iter) \
1869 iter()->reset(iter()->oldTime()); \
1874 #undef RESET_OLD_TIME_TYPE_FIELDS
1884 #define CLEAR_OLD_TIME_TYPE_FIELDS(Type, GeoField) \
1886 HashTable<GeoField<Type>*> fields \
1888 lookupCurrentFields<GeoField<Type>>() \
1891 forAllIter(typename HashTable<GeoField<Type>*>, fields, iter) \
1893 iter()->clearOldTimes(); \
1898 #undef CLEAR_OLD_TIME_TYPE_FIELDS
1902 #define INSERT_FIELD_NAMES(Type, GeoField) \
1903 fieldNames.insert(lookupCurrentFields<GeoField<Type>>(true).toc());
1910 #undef INSERT_FIELD_NAMES
1915 <<
"Non-dynamic and/or internal fields " <<
fieldNames.sortedToc()
1916 <<
" are registered during a reset. Only fields relating to "
1917 <<
"fundamental state should be present at this time, and these "
1918 <<
"should all be dynamic non-internal fields" <<
exit(
FatalError);
1921 subAll_.size_ =
size();
1929 if (statesPtr_.valid())
1934 coordinates_.clear();
1965 elementsGroups[i] =
labelPair(elements[i], 0);
1970 remove(offsets[1] - offsets[0]);
1976 if (nElements == 0)
return;
1988 if (foundObject<LagrangianInternalVectorField>(
positionName))
1991 lookupObjectRef<LagrangianInternalVectorField>(
positionName);
2003 if (!this->foundObject<LagrangianInternalVectorField>(
positionName))
2016 meshObjects::topoChange<LagrangianMesh>(*
this, map);
2024 meshObjects::mapMesh<LagrangianMesh>(*
this, map);
2032 meshObjects::distribute<LagrangianMesh>(*
this, map);
Istream and Ostream manipulators taking arguments.
#define RESET_OLD_TIME_TYPE_FIELDS(Type, GeoField)
#define INIT_EVAL_TYPE_PATCH_FIELDS(Type, GeoField)
#define INJECT_TYPE_FIELDS(Type, GeoField)
#define CLEAR_OLD_TIME_TYPE_FIELDS(Type, GeoField)
#define BIRTH_TYPE_FIELDS(Type, GeoField)
#define OLD_TIME_TYPE_FIELDS(Type, GeoField)
#define PERMUTE_TYPE_FIELDS(Type, GeoField)
#define INJECT_STATE_FIELD(GeoField)
#define INSERT_INTERNAL_FIELD_NAMES(Type, GeoField)
#define INSERT_FIELD_NAMES(Type, GeoField)
#define EVAL_TYPE_PATCH_FIELDS(Type, GeoField)
Various functions to operate on Lists.
graph_traits< Graph >::vertices_size_type size_type
#define forAll(list, i)
Loop across all elements in list.
static LagrangianModels & New(const word &name, const LagrangianMesh &mesh)
Construct and return the named DemandDrivenMeshObject.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
static tmp< DimensionedField< Type, GeoMesh, PrimitiveField > > New(const word &name, const GeoMesh &mesh, const dimensionSet &, const PrimitiveField< Type > &)
Return a temporary field constructed from name, mesh,.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Generic GeometricField class.
A HashTable with keys but without contents.
A primitive field of type <Type> with automated input and output.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
readOption
Enumeration defining the read options.
writeOption & writeOpt() const
const word & name() const
Return name.
writeOption
Enumeration defining the write options.
streamFormat
Enumeration for the format of data in the stream.
compressionType
Enumeration for the format of data in the stream.
const LagrangianMesh & mesh() const
Return the mesh reference.
changer(LagrangianMesh &mesh, const LagrangianState state)
Construct for a Lagrangian mesh with a given state.
linearDisplacement(const LagrangianSubVectorField &linear)
Construct from a reference to the displacement.
parabolicDisplacement(const LagrangianSubVectorField &linear, const LagrangianSubVectorField &quadratic)
Construct from references to the displacements.
Class containing Lagrangian geometry and topology.
LagrangianState state(const label i) const
Return the state for an element of the mesh, or a none state.
const Time & time() const
Return time.
LagrangianMesh(const polyMesh &mesh, const word &name, const IOobject::readOption readOption=IOobject::READ_IF_PRESENT, const IOobject::writeOption writeOption=IOobject::AUTO_WRITE)
Construct from a mesh and a name.
LagrangianSubMesh injectionMesh(const label n) const
Return the sub-mesh associated with an injection of a given.
LagrangianSubMesh birthMesh(const label n) const
Return the sub-mesh associated with birthing a given number of.
const labelIODynamicField & faceTrii() const
Access the face-tet indices.
label size() const
Get the number of elements.
void crossFaces(const LagrangianInternalScalarDynamicField &fraction)
Cross the faces.
virtual void topoChange(const polyTopoChangeMap &)
Update topology using the given map.
location
Enumeration for the locations of searched positions.
virtual void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
tmp< LagrangianInternalVectorField > position() const
Return the global positions.
static const NamedEnum< permutationAlgorithm, 2 > permutationAlgorithmNames_
Permutation algorithm names.
~LagrangianMesh()
Destructor.
static permutationAlgorithm permutationAlgorithm_
Permutation algorithm.
static const word stateName
Name of the state field.
virtual void storePosition()
Store the positions for use during mapping.
partitioningAlgorithm
Enumeration of the partitioning algorithm.
void track(const List< LagrangianState > &endState, const Displacement &displacement, const LagrangianSubScalarField &deltaFraction, LagrangianSubScalarSubField &fraction)
Track the positions along the given displacements.
const labelIODynamicField & celli() const
Access the cell indices.
virtual bool writeObject(IOstream::streamFormat fmt, IOstream::versionNumber ver, IOstream::compressionType cmp, const bool write=true) const
Write using given format, version and compression.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
location locate(const point &position, barycentric &coordinates, label &celli, label &facei, label &faceTrii, const scalar fraction) const
Convert a position into a set of coordinates and a.
static const word coordinatesName
Name of the coordinates field.
virtual void clearPosition()
Clear the positions uses during mapping.
const LagrangianBoundaryMesh & boundary() const
Return reference to boundary mesh.
label nGroups() const
Return the number of groups.
virtual bool write(const bool write=true) const
Write settings from the database.
static const word fractionName
Name of the tracked fraction field.
static const word positionName
Name of the position field.
void reset(const bool initial, const bool final)
Reset the mesh to the old-time conditions.
labelList subMeshGlobalSizes() const
Return the global sizes of all the sub-meshes. A value of -1.
const polyMesh & poly() const
Access the poly mesh.
const LagrangianSolution & solution() const
Access the solution controls.
permutationAlgorithm
Enumeration of the permutation algorithm.
void clear()
Clear all geometry out of the Lagrangian mesh.
const LagrangianSchemes & schemes() const
Access the schemes.
label stateToGroupi(const LagrangianState state) const
Convert a state to a group index.
static partitioningAlgorithm partitioningAlgorithm_
Partitioning algorithm.
void remove(const UList< label > &elements)
Remove specified elements from the mesh. Shuffles everything.
static const NamedEnum< partitioningAlgorithm, 2 > partitioningAlgorithmNames_
Partitioning algorithm names.
void partition()
Partition the mesh such that the groups are contiguous in memory.
LagrangianSubMesh sub(const LagrangianGroup group) const
Return a sub-mesh for the given group.
static const word prefix
Instance prefix.
const List< LagrangianState > & states() const
Return the states.
const barycentricIODynamicField & coordinates() const
Access the coordinates.
const labelIODynamicField & facei() const
Access the cell-face indices.
HashTable< word > modelTypeFieldSourceTypes() const
Return a table of field source types that are chosen to match given.
Selector class for Lagrangian schemes.
Selector class for Lagrangian schemes.
Mesh that relates to a sub-section of a Lagrangian mesh. This is used to construct fields that relate...
label size() const
Return size.
label start() const
Return start.
void size(const label)
Override size to be inconsistent with allocated storage.
static const List< word > & null()
Return a null List.
Initialise the NamedEnum HashTable from the static list of names.
const Field0Type & oldTime() const
Return the old-time field.
void storeOldTimes() const
Store the old-time fields.
void clearOldTimes()
Clear old-time fields.
Buffers for inter-processor communications streams (UOPstream, UIPstream).
void finishedSends(const bool block=true)
Mark all sends as having been done. This will start receives.
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 2-tuple for storing two objects of different types.
const Type2 & second() const
Return second.
const Type1 & first() const
Return first.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
label size() const
Return the number of elements in the UList.
bool empty() const
Return true if the UList is empty (ie, size() is zero)
T & last()
Return the last element of the list.
static const NamedEnum< commsTypes, 3 > commsTypeNames
static label nProcs(const label communicator=0)
Number of processes in parallel run.
static commsTypes defaultCommsType
Default commsType.
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
label size() const
Return the number of elements in the UPtrList.
static direction size()
Return the number of elements in the VectorSpace = Ncmpts.
Centred interpolation interpolation scheme class.
Mesh object that implements searches within the local cells and faces.
label findCell(const point &p, const pointInCellShapes=pointInCellShapes::tets) const
Find the cell containing the given point.
static const meshSearch & New(const polyMesh &mesh, const pointInCellShapes=pointInCellShapes::tets)
Lookup or construct from mesh and cell decomposition option.
Registry of regIOobjects.
virtual bool writeObject(IOstream::streamFormat fmt, IOstream::versionNumber ver, IOstream::compressionType cmp, const bool write) const
Write the objects.
void clear()
Remove all regIOobject owned by the registry.
Motion of the mesh specified as a list of pointMeshMovers.
const labelList & patchIndices() const
Boundary face patch indices.
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Class containing mesh-to-mesh mapping information.
Mesh consisting of general polyhedral cells.
const polyBoundaryMesh & boundary() const
Return boundary mesh.
const labelIOList & tetBasePtIs() const
Return the tetBasePtIs.
virtual const pointField & oldCellCentres() const
Return old cell centres for mesh motion.
A patch is a list of labels that address the faces in the global face list.
label whichFace(const label l) const
Return label of face in patch from global face label.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
const labelList & reverseCellMap() const
Reverse cell map.
label nInternalFaces() const
bool isInternalFace(const label faceIndex) const
Return true if given face label is internal to the mesh.
const cellList & cells() const
virtual bool write(const bool write=true) const
Write using setting from DB.
Struct for keeping processor, element (cell, face, point) index.
label elementi
Element index.
label proci
Processor index.
A class for managing temporary objects.
T & ref() const
Return non-const reference or generate a fatal error.
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 NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
static List< word > fieldNames
Enum namedEnumOptimisationSwitch(const char *name, const NamedEnum< Enum, nEnum > &enumNames, const Enum defaultValue)
Lookup optimisation switch or add default value.
barycentric coordinates(const polyMesh &mesh, const point &position, const label celli, const label facei, const label faceTrii, const scalar stepFraction)
Return the coordinates given the position and tet topology.
Pair< vector > faceNormalAndDisplacement(const polyMesh &mesh, const barycentric &coordinates, const label celli, const label facei, const label faceTrii, const scalar stepFraction)
Return the normal of the corresponding point on the associated face and.
void crossInternalFace(const polyMesh &mesh, barycentric &coordinates, label &celli, label &facei, label &faceTrii)
Cross an internal face.
point position(const polyMesh &mesh, const barycentric &coordinates, const label celli, const label facei, const label faceTrii, const scalar stepFraction)
Return the position given the coordinates and tet topology.
Tuple2< bool, scalar > toFace(const polyMesh &mesh, const Displacement &displacement, const scalar fraction, barycentric &coordinates, label &celli, label &facei, label &faceTrii, scalar &stepFraction, scalar &stepFractionBehind, label &nTracksBehind, const string &debugPrefix=NullObjectRef< string >())
Track along the displacement for a given fraction of the overall.
bool locate(const polyMesh &mesh, const point &position, barycentric &coordinates, label &celli, label &facei, label &faceTrii, const scalar stepFraction, const string &debugPrefix=NullObjectRef< string >())
Initialise the location at the given position. Returns whether or not a.
errorManipArg< error, int > exit(error &err, const int errNo=1)
List< word > wordList
A List of words.
Pair< label > labelPair
Label pair.
const dimensionSet & dimless
List< label > labelList
A List of labels.
Field< barycentric > barycentricField
Barycentric field.
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.
labelList invert(const label len, const labelUList &)
Invert one-to-one map. Unmapped elements will be -1.
Omanip< int > setw(const int i)
const dimensionSet & dimLength
String typeName(const std::type_info &info)
Return the un-mangled name given the standard type info.
labelList findIndices(const ListType &, typename ListType::const_reference, const label start=0)
Find all occurrences of given element. Linear search.
FOR_ALL_FIELD_TYPES(makeDimensionedPointFieldFunctions)
List< bool > boolList
Bool container classes.
LagrangianState
Lagrangian state enumeration.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
List< labelList > labelListList
A List of labelList.
DimensionedField< Type, LagrangianMesh > LagrangianInternalField
GeometricField< Type, LagrangianMesh, LagrangianPrimitiveDynamicField > LagrangianDynamicField
Field< label > labelField
Specialisation of Field<T> for label.
LagrangianSubSubField< scalar > LagrangianSubScalarSubField
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
HashSet wordHashSet
A HashSet with word keys.
LagrangianGroup
Lagrangian group enumeration.
LagrangianSubField< scalar > LagrangianSubScalarField
DimensionedField< Type, LagrangianMesh, LagrangianPrimitiveDynamicField > LagrangianInternalDynamicField
defineTypeNameAndDebug(atmosphericBoundaryLayer, 0)
Ostream & indent(Ostream &os)
Indent stream.
GeometricField< Type, LagrangianMesh > LagrangianField
faceListList boundary(nPatches)
Operator to apply a binary operation to a pair of lists.
Operator to take the first valid process.