73 (LagrangianMesh::typeName +
"Permutation").c_str(),
78 const NamedEnum<LagrangianMesh::partitioningAlgorithm, 2>
86 (LagrangianMesh::typeName +
"Partitioning").c_str(),
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];
249 const List<LagrangianState>& states
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];
299 const List<LagrangianState>& states
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());
507 const LagrangianSubMesh appendMesh
515 if (statesPtr_.valid())
520 if (receivePatchFacePtr_.valid())
522 receivePatchFacePtr_().resize(appendMesh.end(),
label(-1));
525 if (receivePositionPtr_.valid())
527 receivePositionPtr_().resize(appendMesh.end(),
point::nan);
531 celli_.append(celli);
532 facei_.append(facei);
533 faceTrii_.append(faceTrii);
535 subAll_.size_ = size();
548 const LagrangianSubMesh appendMesh
556 if (statesPtr_.valid())
558 states().resize(appendMesh.end());
559 appendMesh.sub(
static_cast<List<LagrangianState>&
>(states())) =
560 UIndirectList<LagrangianState>(states(), parents)();
563 if (receivePatchFacePtr_.valid())
565 receivePatchFacePtr_().resize(appendMesh.end());
566 appendMesh.sub(
static_cast<List<label>&
>(receivePatchFacePtr_())) =
567 UIndirectList<label>(receivePatchFacePtr_(), parents)();
570 if (receivePositionPtr_.valid())
572 receivePositionPtr_().resize(appendMesh.end());
573 appendMesh.sub(
static_cast<List<point>&
>(receivePositionPtr_())) =
574 UIndirectList<point>(receivePositionPtr_(), parents)();
577 coordinates_.resize(appendMesh.end());
578 appendMesh.sub(
static_cast<List<barycentric>&
>(coordinates_)) =
579 UIndirectList<barycentric>(coordinates_, parents)();
580 celli_.resize(appendMesh.end());
581 appendMesh.sub(
static_cast<labelList&
>(celli_)) =
582 UIndirectList<label>(celli_, parents)();
583 facei_.resize(appendMesh.end());
584 appendMesh.sub(
static_cast<labelList&
>(facei_)) =
585 UIndirectList<label>(facei_, parents)();
586 faceTrii_.resize(appendMesh.end());
587 appendMesh.sub(
static_cast<labelList&
>(faceTrii_)) =
588 UIndirectList<label>(faceTrii_, parents)();
590 subAll_.size_ = size();
598 const LagrangianSubMesh&
605 void Foam::LagrangianMesh::injectUnspecifiedFields
607 const LagrangianInjection& injection,
608 const LagrangianSubMesh& injectionMesh,
614 #define INJECT_TYPE_FIELDS(Type, GeoField) \
616 HashTable<GeoField<Type>*> fields \
618 lookupCurrentFields<GeoField<Type>>() \
621 forAllIter(typename HashTable<GeoField<Type>*>, fields, iter) \
623 if (specifiedFieldNames.found(iter()->name())) continue; \
625 injectedFieldNames.insert(iter()->name()); \
628 iter()->resize(injectionMesh.end()); \
631 injectionMesh.sub(*iter()).ref() = \
632 iter()->sources()[injection.name()].value \
643 #undef INJECT_TYPE_FIELDS
646 #define INJECT_STATE_FIELD(GeoField) \
648 if (foundObject<GeoField<label>>(stateName)) \
650 GeoField<label>& state = \
651 lookupObjectRef<GeoField<label>>(stateName); \
653 injectedFieldNames.insert(stateName); \
656 state.resize(injectionMesh.end()); \
659 injectionMesh.sub(state).ref() = \
660 static_cast<label>(LagrangianState::none); \
665 #undef INJECT_STATE_FIELD
669 #define INSERT_INTERNAL_FIELD_NAMES(Type, GeoField) \
671 HashTable<GeoField<Type>*> fields \
673 lookupCurrentFields<GeoField<Type>>() \
676 forAllIter(typename HashTable<GeoField<Type>*>, fields, iter) \
678 if (specifiedFieldNames.found(iter()->name())) continue; \
679 if (injectedFieldNames.found(iter()->name())) continue; \
681 internalFieldNames.insert(iter()->name()); \
692 #undef INSERT_INTERNAL_FIELD_NAMES
694 if (!internalFieldNames.empty())
697 <<
"Internal fields " << internalFieldNames.sortedToc() <<
" are "
698 <<
"registered during an injection event. These fields do not "
699 <<
"contain source conditions so their new values cannot be "
700 <<
"assigned. Either specify these fields' values in the calling "
701 <<
"code, or ensure that they are not registered."
707 void Foam::LagrangianMesh::injectUnspecifiedFields
709 const LagrangianSubMesh& injectionMesh,
714 #define INSERT_FIELD_NAMES(Type, GeoField) \
715 fieldNames.insert(lookupCurrentFields<GeoField<Type>>().toc());
724 #undef INSERT_FIELD_NAMES
729 <<
"Fields " <<
fieldNames.sortedToc() <<
" are registered during "
730 <<
"an injection event. These fields' new values cannot be "
731 <<
"assigned. Either specify these fields' values in the calling "
732 <<
"code, or ensure that they are not registered."
738 void Foam::LagrangianMesh::birthUnspecifiedFields
741 const LagrangianSubMesh& birthMesh,
746 #define BIRTH_TYPE_FIELDS(Type, GeoField) \
748 HashTable<GeoField<Type>*> fields \
750 lookupCurrentFields<GeoField<Type>>() \
753 forAllIter(typename HashTable<GeoField<Type>*>, fields, iter) \
755 if (specifiedFieldNames.found(iter()->name())) continue; \
756 if (birthedFieldNames.found(iter()->name())) continue; \
758 birthedFieldNames.insert(iter()->name()); \
761 iter()->resize(birthMesh.end()); \
764 birthMesh.sub(*iter()).ref().primitiveFieldRef() = \
765 Field<Type>(UIndirectList<Type>(*iter(), parents)()); \
776 #undef BIRTH_TYPE_FIELDS
780 void Foam::LagrangianMesh::changer::constructNonConformal()
const
782 bool haveNccPatches =
false;
786 const polyPatch& pp = mesh_.mesh().boundaryMesh()[
patchi];
788 if (isA<nonConformalCyclicPolyPatch>(pp))
790 haveNccPatches =
true;
795 if (!haveNccPatches)
return;
797 mesh_.origPatchNccPatchisPtr_.set
801 mesh_.boundary().size(),
805 mesh_.origPatchNccPatchesPtr_.set
807 new List<UPtrList<const nonConformalCyclicPolyPatch>>
809 mesh_.boundary().size(),
810 UPtrList<const nonConformalCyclicPolyPatch>()
813 mesh_.nccPatchProcNccPatchisPtr_.set
817 mesh_.boundary().size(),
824 const polyPatch& pp = mesh_.mesh().boundaryMesh()[
patchi];
826 if (isA<nonConformalCyclicPolyPatch>(pp))
828 const nonConformalCyclicPolyPatch& nccPp =
829 refCast<const nonConformalCyclicPolyPatch>(pp);
831 mesh_.origPatchNccPatchisPtr_()
832 [nccPp.origPatchIndex()].append(
patchi);
833 mesh_.origPatchNccPatchesPtr_()
834 [nccPp.origPatchIndex()].append(&nccPp);
836 mesh_.nccPatchProcNccPatchisPtr_()
840 if (nccPp.owner()) nccPp.rays();
842 else if (isA<nonConformalProcessorCyclicPolyPatch>(pp))
844 const nonConformalProcessorCyclicPolyPatch& ncpcPp =
845 refCast<const nonConformalProcessorCyclicPolyPatch>(pp);
847 mesh_.nccPatchProcNccPatchisPtr_()
848 [ncpcPp.referPatchIndex()][ncpcPp.neighbProcNo()] =
853 mesh_.receivePatchFacePtr_.set
855 new DynamicList<label>(mesh_.size(),
label(-1))
858 mesh_.receivePositionPtr_.set
860 new DynamicList<point>(mesh_.size(),
point::nan)
865 void Foam::LagrangianMesh::changer::constructBehind()
const
867 mesh_.fractionBehindPtr_.set
869 new LagrangianDynamicField<scalar>
873 fractionName +
"Behind",
880 dimensioned<scalar>(
dimless, scalar(0)),
883 mesh_.boundary().size(),
884 calculatedLagrangianPatchScalarField::typeName
890 zeroLagrangianScalarFieldSource,
892 internalLagrangianScalarFieldSource
897 mesh_.nTracksBehindPtr_.set
899 new LagrangianDynamicField<label>
913 mesh_.boundary().size(),
914 calculatedLagrangianPatchLabelField::typeName
920 zeroLagrangianLabelFieldSource,
922 internalLagrangianLabelFieldSource
943 mesh.boundaryMesh().types(),
1017 boundary_(*this,
mesh.boundaryMesh(), wantedPatchTypes),
1029 statesPtr_(nullptr),
1030 offsetsPtr_(nullptr),
1032 schemesPtr_(nullptr)
1036 checkFieldSize(coordinates_);
1037 checkFieldSize(celli_);
1041 if (!celli_.empty() && facei_.empty())
1055 if (!cellFacei.
empty())
1057 checkFieldSize(cellFacei);
1058 facei_.resize(cellFacei.
size());
1061 facei_[i] = mesh_.
cells()[celli_[i]][cellFacei[i]];
1066 checkFieldSize(facei_);
1067 checkFieldSize(faceTrii_);
1088 mesh_.statesPtr_.set
1093 mesh_.offsetsPtr_.set
1105 mesh_.offsetsPtr_()[groupi] = mesh_.
size();
1108 constructNonConformal();
1110 mesh_.subMeshIndex_ = 0;
1113 mesh_.printGroups(
true);
1115 mesh_.printGroups(
false);
1135 mesh_.statesPtr_.set
1140 mesh_.offsetsPtr_.set
1145 constructNonConformal();
1147 mesh_.subMeshIndex_ = 0;
1150 mesh_.printGroups(
true);
1166 mesh_.statesPtr_.
clear();
1167 mesh_.offsetsPtr_.
clear();
1169 mesh_.origPatchNccPatchisPtr_.
clear();
1170 mesh_.origPatchNccPatchesPtr_.
clear();
1171 mesh_.nccPatchProcNccPatchisPtr_.
clear();
1172 mesh_.receivePatchFacePtr_.
clear();
1173 mesh_.receivePositionPtr_.
clear();
1175 mesh_.fractionBehindPtr_.
clear();
1176 mesh_.nTracksBehindPtr_.
clear();
1178 mesh_.subMeshIndex_ = 0;
1182 mesh_.boundary()[
patchi].partition();
1203 quadratic_(quadratic)
1211 if (!schemesPtr_.valid())
1216 return schemesPtr_();
1222 if (!solutionPtr_.valid())
1227 return solutionPtr_();
1239 if (isA<processorPolyPatch>(pp))
break;
1246 static const label completei =
1248 static const label inInternalMeshi =
1250 static const label onPatchZeroi =
1260 if (isA<processorPolyPatch>(pp))
break;
1274 for (
label i = 0; i < nGlobalGroups - 1; ++ i)
1276 result[i] = sizes[i];
1312 coordinates_[i], celli_[i], facei_[i], faceTrii_[i], 1
1324 const scalar fraction
1371 procCelli[i].proci =
1406 checkPtr(offsetsPtr_,
"Offsets");
1414 permutation = partitionBin(offsets,
states());
1418 permutation = partitionQuick(offsets,
states());
1428 permuteList(permutation,
states());
1429 permuteList(permutation, coordinates_);
1430 permuteList(permutation, celli_);
1431 permuteList(permutation, facei_);
1432 permuteList(permutation, faceTrii_);
1435 if (receivePatchFacePtr_.valid())
1437 permuteList(permutation, receivePatchFacePtr_());
1439 if (receivePositionPtr_.valid())
1441 permuteList(permutation, receivePositionPtr_());
1448 for (
label i = offsets[groupi]; i < offsets[groupi + 1]; ++ i)
1453 <<
"Partitioning failed"
1464 resizeContainer(
states());
1465 resizeContainer(coordinates_);
1466 resizeContainer(celli_);
1467 resizeContainer(facei_);
1468 resizeContainer(faceTrii_);
1471 if (receivePatchFacePtr_.valid())
1473 resizeContainer(receivePatchFacePtr_());
1475 if (receivePositionPtr_.valid())
1477 resizeContainer(receivePositionPtr_());
1481 permuteAndResizeFields(permutation);
1490 subAll_.size_ =
size();
1494 template<
class Displacement>
1498 const Displacement& displacement,
1512 const label i = subi + fraction.
mesh().start();
1518 mesh_, displacement(subi), deltaFraction[subi],
1519 coordinates_[i], celli_[i], facei_[i], faceTrii_[i],
1521 fractionBehindPtr_()[i], nTracksBehindPtr_()[i],
1524 : NullObjectRef<string>()
1528 if (!onFaceAndF.
first())
1530 states()[i] = endState[subi];
1550 origPatchNccPatchisPtr_.valid()
1555 const point sendPosition =
1559 coordinates_[i], celli_[i], facei_[i], faceTrii_[i],
1564 const vector sendDisplacement =
1568 coordinates_[i], celli_[i], facei_[i], faceTrii_[i],
1573 forAll(origPatchNccPatchisPtr_()[
patchi], patchNccPatchi)
1575 const label nccPatchi =
1576 origPatchNccPatchisPtr_()[
patchi][patchNccPatchi];
1578 origPatchNccPatchesPtr_()[
patchi][patchNccPatchi];
1580 point receivePosition;
1581 const remote receiveProcAndFace =
1587 displacement(subi, onFaceAndF.
second())
1588 - fraction[subi]*sendDisplacement,
1592 const label receiveProci = receiveProcAndFace.
proci;
1594 if (receiveProci == -1)
continue;
1598 receivePatchFacePtr_()[i] = receiveFacei;
1599 receivePositionPtr_()[i] = receivePosition;
1602 nccPatchProcNccPatchisPtr_()[nccPatchi][receiveProci];
1621 void Foam::LagrangianMesh::track<Foam::LagrangianMesh::linearDisplacement>
1623 const List<LagrangianState>& endState,
1624 const linearDisplacement& displacement,
1631 void Foam::LagrangianMesh::track<Foam::LagrangianMesh::parabolicDisplacement>
1633 const List<LagrangianState>& endState,
1634 const parabolicDisplacement& displacement,
1653 forAll(incompleteMesh, subi)
1655 const label i = subi + incompleteMesh.
start();
1663 coordinates_[i], celli_[i], facei_[i], faceTrii_[i]
1686 #define INIT_EVAL_TYPE_PATCH_FIELDS(Type, GeoField) \
1688 HashTable<GeoField<Type>*> fields \
1690 lookupCurrentFields<GeoField<Type>>() \
1693 forAllIter(typename HashTable<GeoField<Type>*>, fields, iter) \
1695 forAll(boundary(), patchi) \
1697 iter()->boundaryFieldRef()[patchi].initEvaluate \
1709 #undef INIT_EVAL_TYPE_PATCH_FIELDS
1721 #define EVAL_TYPE_PATCH_FIELDS(Type, GeoField) \
1723 HashTable<GeoField<Type>*> fields \
1725 lookupCurrentFields<GeoField<Type>>() \
1728 forAllIter(typename HashTable<GeoField<Type>*>, fields, iter) \
1730 forAll(boundary(), patchi) \
1732 iter()->boundaryFieldRef()[patchi].evaluate \
1744 #undef EVAL_TYPE_PATCH_FIELDS
1749 <<
"Unsupported communications type "
1760 if (initial &&
final)
return;
1773 #define OLD_TIME_TYPE_FIELDS(Type, GeoField) \
1775 HashTable<GeoField<Type>*> fields \
1777 lookupCurrentFields<GeoField<Type>>() \
1780 forAllIter(typename HashTable<GeoField<Type>*>, fields, iter) \
1782 iter()->storeOldTimes(); \
1783 iter()->oldTime(); \
1788 #undef OLD_TIME_TYPE_FIELDS
1799 #define RESET_OLD_TIME_TYPE_FIELDS(Type, GeoField) \
1801 HashTable<GeoField<Type>*> fields \
1803 lookupCurrentFields<GeoField<Type>>() \
1806 forAllIter(typename HashTable<GeoField<Type>*>, fields, iter) \
1808 iter()->reset(iter()->oldTime()); \
1813 #undef RESET_OLD_TIME_TYPE_FIELDS
1823 #define CLEAR_OLD_TIME_TYPE_FIELDS(Type, GeoField) \
1825 HashTable<GeoField<Type>*> fields \
1827 lookupCurrentFields<GeoField<Type>>() \
1830 forAllIter(typename HashTable<GeoField<Type>*>, fields, iter) \
1832 iter()->clearOldTimes(); \
1837 #undef CLEAR_OLD_TIME_TYPE_FIELDS
1841 #define INSERT_FIELD_NAMES(Type, GeoField) \
1842 fieldNames.insert(lookupCurrentFields<GeoField<Type>>(true).toc());
1849 #undef INSERT_FIELD_NAMES
1854 <<
"Non-dynamic and/or internal fields " <<
fieldNames.sortedToc()
1855 <<
" are registered during a reset. Only fields relating to "
1856 <<
"fundamental state should be present at this time, and these "
1857 <<
"should all be dynamic non-internal fields" <<
exit(
FatalError);
1860 subAll_.size_ =
size();
1868 if (statesPtr_.valid())
1873 coordinates_.clear();
1904 elementsGroups[i] =
labelPair(elements[i], 0);
1909 remove(offsets[1] - offsets[0]);
1915 if (nElements == 0)
return;
1927 if (foundObject<LagrangianVectorInternalField>(
positionName))
1929 lookupObjectRef<LagrangianVectorInternalField>(
positionName).checkOut();
1936 if (!this->foundObject<LagrangianVectorInternalField>(
positionName))
1949 meshObjects::topoChange<LagrangianMesh>(*
this, map);
1957 meshObjects::mapMesh<LagrangianMesh>(*
this, map);
1965 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.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
const Mesh & mesh() const
Return mesh.
static tmp< DimensionedField< Type, GeoMesh, PrimitiveField > > New(const word &name, const Mesh &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 mesh wrapper used by volMesh, surfaceMesh, pointMesh etc.
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.
const labelIODynamicField & faceTrii() const
Access the face-tet indices.
const polyMesh & mesh() const
Access the mesh.
label size() const
Get the number of elements.
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.
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.
tmp< LagrangianVectorInternalField > position() const
Return the global positions.
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 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.
void crossFaces(const LagrangianScalarInternalDynamicField &fraction)
Cross the faces.
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.
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.
static autoPtr< dictionary > New(Istream &)
Construct top-level dictionary on freestore from Istream.
Centred interpolation interpolation scheme class.
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.
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 labelIOList & tetBasePtIs() const
Return the tetBasePtIs.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
const indexedOctree< treeDataCell > & cellTree() const
Return the cell search tree.
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.
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)
labelList findIndices(const ListType &, typename ListType::const_reference, const label start=0)
Find all occurrences of given element. Linear search.
const dimensionSet dimless
const dimensionSet dimLength
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
defineTypeNameAndDebug(combustionModel, 0)
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.
FOR_ALL_FIELD_TYPES(makeFieldSourceTypedef)
LagrangianSubField< scalar > LagrangianSubScalarField
DimensionedField< Type, LagrangianMesh, LagrangianPrimitiveDynamicField > LagrangianInternalDynamicField
Ostream & indent(Ostream &os)
Indent stream.
GeometricField< Type, LagrangianMesh > LagrangianField
Operator to apply a binary operation to a pair of lists.
Operator to take the first valid process.