LagrangianMesh.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2025-2026 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::LagrangianMesh
26 
27 Description
28  Class containing Lagrangian geometry and topology
29 
30 SourceFiles
31  LagrangianMesh.C
32  LagrangianMeshTemplates.C
33  LagrangianMeshI.H
34  LagrangianMeshLocation.H
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef LagrangianMesh_H
39 #define LagrangianMesh_H
40 
41 #include "barycentricField.H"
43 #include "LagrangianBoundaryMesh.H"
44 #include "LagrangianFieldsFwd.H"
45 #include "LagrangianSchemes.H"
46 #include "LagrangianSolution.H"
47 #include "LagrangianState.H"
48 #include "LagrangianSubMesh.H"
49 #include "labelIODynamicField.H"
50 #include "polyMesh.H"
51 
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 
54 namespace Foam
55 {
56 
57 class LagrangianInjection;
58 class nonConformalCyclicPolyPatch;
59 
60 /*---------------------------------------------------------------------------*\
61  Class LagrangianMesh Declaration
62 \*---------------------------------------------------------------------------*/
63 
64 class LagrangianMesh
65 :
66  public objectRegistry
67 {
68 public:
69 
70  // Public Enumerations
71 
72  //- Enumeration of the permutation algorithm
73  enum class permutationAlgorithm
74  {
75  copy,
76  inPlace
77  };
78 
79  //- Permutation algorithm names
82 
83  //- Enumeration of the partitioning algorithm
84  enum class partitioningAlgorithm
85  {
86  bin,
87  quick
88  };
89 
90  //- Partitioning algorithm names
93 
94  //- Enumeration for the locations of searched positions
95  enum class location
96  {
97  inCell,
98  onBoundary,
100  };
101 
102 
103 private:
104 
105  // Private Data
106 
107  //- Reference to the mesh
108  const polyMesh& mesh_;
109 
110  //- Local coordinates of the elements within their tetrahedra
111  barycentricIODynamicField coordinates_;
112 
113  //- Indices of the cells that contain the tetrahedra
114  labelIODynamicField celli_;
115 
116  //- Indices of the faces that form the bases of the tetrahedra
117  labelIODynamicField facei_;
118 
119  //- Indices of the face-triangles that form the bases of the tetrahedra
120  labelIODynamicField faceTrii_;
121 
122  //- Boundary mesh
123  LagrangianBoundaryMesh boundary_;
124 
125  //- A special sub-mesh which spans the entire mesh
126  LagrangianSubMesh subAll_;
127 
128  //- The elements' states
130 
131  //- Offsets defining ranges associated with the elements' groups
132  autoPtr<labelList> offsetsPtr_;
133 
134  //- For every patch, a list of associated non-conformal cyclic patch
135  // indices. Empty if there are no non-conformal cyclic patches.
136  autoPtr<labelListList> origPatchNccPatchisPtr_;
137 
138  //- For every patch, a list of associated non-conformal cyclic patch
139  // pointers. Empty if there are no non-conformal cyclic patches.
141  origPatchNccPatchesPtr_;
142 
143  //- For every non-conformal cyclic patch, the indices of the associated
144  // non-conformal processor-cyclic patches. Empty if there are no
145  // non-conformal cyclic patches.
146  autoPtr<labelListList> nccPatchProcNccPatchisPtr_;
147 
148  //- The receiving patch face for non-conformal cyclic transfers
149  autoPtr<DynamicList<label>> receivePatchFacePtr_;
150 
151  //- The receiving position for non-conformal cyclic transfers
152  autoPtr<DynamicList<point>> receivePositionPtr_;
153 
154  //- The step fraction less than the maximum reached so far. See
155  // tracking.H for details.
156  autoPtr<LagrangianDynamicField<scalar>> fractionBehindPtr_;
157 
158  //- The number of tracks carried out that ended in a step fraction less
159  // than the maximum reached so far. See tracking.H for details.
160  autoPtr<LagrangianDynamicField<label>> nTracksBehindPtr_;
161 
162  //- Sub-mesh index
163  mutable uint64_t subMeshIndex_;
164 
165  //- Schemes created on demand
166  mutable autoPtr<LagrangianSchemes> schemesPtr_;
167 
168  //- Solution controls created on demand
169  mutable autoPtr<LagrangianSolution> solutionPtr_;
170 
171 
172  // Private Member Functions
173 
174  // Checks
175 
176  //- Check that the field is the same size as the mesh
177  template<class Field>
178  inline void checkFieldSize(const Field& field) const;
179 
180  //- Check that a pointer is valid
181  template<class Type>
182  inline void checkPtr
183  (
184  const autoPtr<Type>& ptr,
185  const word& name
186  ) const;
187 
188  //- Print a row of the group table
189  void printGroups(const bool header) const;
190 
191 
192  // Partitioning and Permutation
193 
194  //- Partition the states using the bin-sort-based algorithm
195  labelList partitionBin
196  (
197  labelList& offsets,
199  ) const;
200 
201  //- Partition the states using a quick-sort-based algorithm
202  labelList partitionQuick
203  (
204  labelList& offsets,
206  ) const;
207 
208  //- Reorder and resize all registered fields using the given
209  // permutation
210  void permuteAndResizeFields(const labelList& permutation);
211 
212  //- Reorder a list with the given permutation
213  template<class Type>
214  static void permuteList
215  (
216  const labelList& permutation,
217  UList<Type>& list
218  );
219 
220  //- Reorder a list using the copy algorithm
221  template<class Type>
222  static void permuteListCopy
223  (
224  const labelList& permutation,
225  UList<Type>& list
226  );
227 
228  //- Reorder a list using the in-place algorithm
229  template<class Type>
230  static void permuteListInPlace
231  (
232  const labelList& permutation,
233  UList<Type>& list
234  );
235 
236  //- Resize a container to match the mesh
237  template<class Container>
238  void resizeContainer(Container& container) const;
239 
240 
241  // Addition
242 
243  //- Return the sub-mesh associated with appending a given number of
244  // elements
245  LagrangianSubMesh appendMesh(const label n) const;
246 
247  //- Append specified elements in the mesh with the given geometry
248  // and topology. Does nothing to fields.
249  void append
250  (
251  const LagrangianSubMesh& appendMesh,
253  const labelField& celli,
254  const labelField& facei,
255  const labelField& faceTrii
256  );
257 
258  //- As above but creates and returns the sub-mesh
259  LagrangianSubMesh append
260  (
262  const labelField& celli,
263  const labelField& facei,
264  const labelField& faceTrii
265  );
266 
267  //- Birth specified elements in the mesh from the given list of
268  // parent indices. Does nothing to fields.
269  void append
270  (
271  const LagrangianSubMesh& appendMesh,
272  const labelList& parents
273  );
274 
275  //- As above but creates and returns the sub-mesh
276  LagrangianSubMesh append
277  (
278  const labelList& parents
279  );
280 
281  //- Expand and set values for explicitly specified fields following
282  // an injection or birth event
283  template<class Type, template<class> class GeoField>
284  void appendSpecifiedField
285  (
286  const LagrangianSubMesh& appendMesh,
287  GeoField<Type>& geoField,
288  const Field<Type>& field
289  ) const;
290 
291  //- Expand and set values for explicitly specified fields following
292  // an injection or birth event
293  template<class Type, template<class> class GeoField>
294  bool appendSpecifiedField
295  (
296  const LagrangianSubMesh& appendMesh,
297  const word& fieldName,
298  const Field<Type>& field
299  ) const;
300 
301  //- Expand and set values for explicitly specified fields following
302  // an injection or birth event
303  template<class Type, class ... FieldNamesAndFields>
304  wordHashSet appendSpecifiedFields
305  (
306  const LagrangianSubMesh& appendMesh,
307  const word& fieldName,
308  const Field<Type>& field,
309  const FieldNamesAndFields& ... fieldNamesAndFields
310  ) const;
311 
312  //- Termination clause for the above
313  wordHashSet appendSpecifiedFields
314  (
315  const LagrangianSubMesh& appendMesh
316  ) const;
317 
318  //- Expand and set values for unspecified fields following an
319  // injection
320  void injectUnspecifiedFields
321  (
323  const wordHashSet& specifiedFieldNames
324  );
325 
326  //- Expand and set values for unspecified fields following an
327  // injection
328  void injectUnspecifiedFields
329  (
330  const LagrangianInjection& injection,
332  const wordHashSet& specifiedFieldNames
333  );
334 
335  //- Expand and set values for unspecified fields following a birth
336  void birthUnspecifiedFields
337  (
338  const labelList& parents,
340  const wordHashSet& specifiedFieldNames
341  );
342 
343 
344 public:
345 
346  // Friend classes
347 
348  //- The non-conformal cyclic patch needs to access the receiving
349  // information populated during tracking
351 
352  //- The processor patch communicates and adds elements to the receiving
353  // side, but field values are added later by the corresponding patch
354  // field. This is not permitted by the public interface in which
355  // elements and associated field values are required to be added
356  // simultaneously so that they are guaranteed to remain consistent.
357  // The requirements of the processor patch and patch fields are
358  // considered a special case, so access to the private append methods
359  // is permitted to these classes.
360  friend class processorLagrangianPatch;
361 
362  //- See above
363  template<class Type>
364  friend class processorLagrangianPatchField;
365 
366  //- See above
368 
369  //- See above
370  template<class Type>
372 
373 
374  // Public classes
375 
376  //- Class to define the scope of Lagrangian mesh state changes
377  class changer
378  {
379  // Private Data
380 
381  //- Reference to the Lagrangian mesh
382  LagrangianMesh& mesh_;
383 
384 
385  // Private Member Functions
386 
387  //- Construct the mesh's non-conformal data
388  void constructNonConformal() const;
389 
390  //- Construct the mesh's behind data
391  void constructBehind() const;
392 
393 
394  public:
395 
396  // Constructors
397 
398  //- Construct for a Lagrangian mesh with a given state
399  changer
400  (
402  const LagrangianState state
403  );
404 
405  //- Construct for a Lagrangian mesh with given states
406  changer
407  (
410  );
411 
412 
413  // Destructor
414  ~changer();
415  };
416 
417  //- Class to hold and index into the field references associated with a
418  // linear displacement
419  class linearDisplacement
420  {
421  // Private Data
422 
423  //- Reference to the linear displacement
424  const LagrangianSubVectorField& linear_;
425 
426  public:
427 
428  // Constructors
429 
430  //- Construct from a reference to the displacement
432 
433 
434  // Member Operators
435 
436  //- The displacement for a given index
437  inline const vector& operator()(const label i) const;
438 
439  //- The displacement for a given index and remaining fraction
440  inline const vector& operator()
441  (
442  const label i,
443  const scalar f
444  ) const;
445  };
446 
447  //- Class to hold and index into the field references associated with a
448  // parabolic displacement
450  {
451  // Private Data
452 
453  //- Reference to the linear displacement
454  const LagrangianSubVectorField& linear_;
455 
456  //- Reference to the quadratic displacement
457  const LagrangianSubVectorField& quadratic_;
458 
459 
460  public:
461 
462  // Constructors
463 
464  //- Construct from references to the displacements
466  (
468  const LagrangianSubVectorField& quadratic
469  );
470 
471 
472  // Member Operators
473 
474  //- The displacements for a given index
475  inline Pair<vector> operator()(const label i) const;
476 
477  //- The displacement for a given index and remaining fraction
478  inline vector operator()
479  (
480  const label i,
481  const scalar f
482  ) const;
483  };
484 
485  //- Class to hold element-group indices, and associate the group
486  // indices with a given enumeration. Binary compatible with labelPair
487  // so that a UList<elementGroup<Enumeration>> can be cast to a
488  // UList<labelPair>. This allows the labelPair-based partition
489  // function to be used with an arbitrary enumeration without
490  // templating the implementation.
491  template<class Enumeration>
492  class elementGroup
493  :
494  private labelPair
495  {
496  //- Reference class returned by the group accessors
497  class EnumerationRef
498  {
499  private:
500 
501  label& i_;
502 
503  public:
504 
505  EnumerationRef(label& i)
506  :
507  i_(i)
508  {}
509 
510  operator Enumeration() const
511  {
512  return static_cast<Enumeration>(i_);
513  }
514 
515  void operator=(const Enumeration e)
516  {
517  i_ = static_cast<label>(e);
518  }
519  };
520 
521  //- Modify the element index
522  label& element()
523  {
524  return first();
525  }
526 
527  //- Access the element index
528  label element() const
529  {
530  return first();
531  }
532 
533  //- Modify the group enumeration
534  EnumerationRef group()
535  {
536  return EnumerationRef(second());
537  }
538 
539  //- Access the group enumeration
540  Enumeration group() const
541  {
542  return static_cast<Enumeration>(second());
543  }
544  };
545 
546 
547  // Public Static Data
548 
549  //- Run-time type information
550  ClassName("LagrangianMesh");
551 
552  //- Instance prefix
553  static const word prefix;
554 
555  //- Name of the coordinates field
556  static const word coordinatesName;
557 
558  //- Name of the position field
559  static const word positionName;
560 
561  //- Name of the state field
562  static const word stateName;
563 
564  //- Name of the tracked fraction field
565  static const word fractionName;
566 
567  //- Permutation algorithm
569 
570  //- Partitioning algorithm
572 
573 
574  // Public Type Definitions
575 
576  //- Mesh type
577  typedef LagrangianMesh Mesh;
578 
579  //- Boundary mesh type
581 
582  //- Patch field type
583  template<class Type>
585 
586  //- Field source type
587  template<class Type>
589 
590 
591  // Constructors
592 
593  //- Construct from a mesh and a name
595  (
596  const polyMesh& mesh,
597  const word& name,
600  );
601 
602  //- Construct from a mesh and a name and a list of patch types
604  (
605  const polyMesh& mesh,
606  const word& name,
607  const wordList& wantedPatchTypes,
610  );
611 
612  //- Disallow default bitwise copy construction
613  LagrangianMesh(const LagrangianMesh&) = delete;
614 
615 
616  //- Destructor
617  ~LagrangianMesh();
618 
619 
620  // Member Functions
621 
622  // Access
623 
624  using objectRegistry::time;
625  using objectRegistry::operator!=;
626  using objectRegistry::operator==;
627 
628  //- Return database
629  const objectRegistry& db() const
630  {
631  return *this;
632  }
633 
634  //- Access the poly mesh
635  inline const polyMesh& poly() const;
636 
637  //- Access the coordinates
638  inline const barycentricIODynamicField& coordinates() const;
639 
640  //- Access the cell indices
641  inline const labelIODynamicField& celli() const;
642 
643  //- Access the cell-face indices
644  inline const labelIODynamicField& facei() const;
645 
646  //- Access the face-tet indices
647  inline const labelIODynamicField& faceTrii() const;
648 
649  //- Return reference to boundary mesh
650  inline const LagrangianBoundaryMesh& boundary() const;
651 
652  //- Return whether or not the mesh is changing
653  inline bool changing() const;
654 
655  //- Return the states
656  inline const List<LagrangianState>& states() const;
657 
658  //- Access the states
659  inline List<LagrangianState>& states();
660 
661  //- Return the state for an element of the mesh, or a none state
662  // if not changing
663  inline LagrangianState state(const label i) const;
664 
665  //- Return the state for an element of a sub mesh, or a none state
666  // if not changing
667  inline LagrangianState state
668  (
669  const LagrangianSubMesh& subMesh,
670  const label subi
671  ) const;
672 
673  //- Get a sub-mesh index
674  inline uint64_t subMeshIndex() const;
675 
676  //- Access the schemes
677  const LagrangianSchemes& schemes() const;
678 
679  //- Access the solution controls
680  const LagrangianSolution& solution() const;
681 
682  //- Lookup all current-time fields of the given type
683  template<class GeoField>
685  (
686  const bool strict = false
687  ) const;
688 
689  //- Lookup all current-time fields of the given type
690  template<class GeoField>
692  (
693  const bool strict = false
694  );
695 
696 
697  // Check
698 
699  //- Get the number of elements
700  inline label size() const;
701 
702  //- Get the global number of elements
703  inline label globalSize() const;
704 
705  //- Return size
706  static inline label size(const LagrangianMesh& mesh);
707 
708  //- Return the number of states
709  inline label nStates() const;
710 
711  //- Return the number of groups
712  inline label nGroups() const;
713 
714  //- Convert a state to a group index
715  inline label stateToGroupi(const LagrangianState state) const;
716 
717  //- Return a sub-mesh for the given group
718  inline LagrangianSubMesh sub(const LagrangianGroup group) const;
719 
720  //- Return a sub-mesh for no elements
721  inline LagrangianSubMesh subNone() const;
722 
723  //- Return a sub-mesh for all elements
724  inline const LagrangianSubMesh& subAll() const;
725 
726  //- Return a sub-mesh for all incomplete elements
727  inline LagrangianSubMesh subIncomplete() const;
728 
729  //- Return the global sizes of all the sub-meshes. A value of -1
730  // will be set for processor-patch sub-meshes.
732 
733  //- Return the global positions
735 
736  //- Return the global positions for a sub-mesh
738  (
739  const LagrangianSubMesh& subMesh
740  ) const;
741 
742  //- Return the global position of an element
743  point position(const label i) const;
744 
745  //- Convert a position into a set of coordinates and a
746  // corresponding tetrahedron. Return a status flag indicating
747  // where the point is relative to the bounds of the mesh.
749  (
750  const point& position,
752  label& celli,
753  label& facei,
754  label& faceTrii,
755  const scalar fraction
756  ) const;
757 
758  //- Convert set of positions into a set of coordinates and a
759  // corresponding tetrahedron. Return status flags indicating
760  // where the points are relative to the bounds of the mesh.
762  (
763  const List<point>& position,
765  labelList& celli,
766  labelList& facei,
768  const scalarList& fraction
769  ) const;
770 
771 
772  // Modify
773 
774  //- Partition the mesh such that the groups are contiguous in memory
775  void partition();
776 
777  //- Track the positions along the given displacements
778  template<class Displacement>
779  void track
780  (
781  const List<LagrangianState>& endState,
782  const Displacement& displacement,
783  const LagrangianSubScalarField& deltaFraction,
785  );
786 
787  //- Cross the faces
788  void crossFaces
789  (
791  );
792 
793  //- Return the sub-mesh associated with an injection of a given
794  // number of elements
795  LagrangianSubMesh injectionMesh(const label n) const;
796 
797  //- Inject specified elements into the mesh. This method does not
798  // know how to set values for the fields. If any fields are
799  // registered then this function will error.
800  template<class ... FieldNamesAndFields>
801  void inject
802  (
805  const labelField& celli,
806  const labelField& facei,
807  const labelField& faceTrii,
808  const FieldNamesAndFields& ... fieldNamesAndFields
809  );
810 
811  //- As above but creates and returns the sub-mesh
812  template<class ... FieldNamesAndFields>
814  (
816  const labelField& celli,
817  const labelField& facei,
818  const labelField& faceTrii,
819  const FieldNamesAndFields& ... fieldNamesAndFields
820  );
821 
822  //- Inject specified elements into the mesh. Fields are expanded
823  // accordingly. New field values can be specified manually by
824  // providing alternating name and field arguments. Source
825  // conditions will be used to set values for all other fields.
826  // Internal fields without source conditions must be specified
827  // manually or an error will result.
828  template<class ... FieldNamesAndFields>
829  void inject
830  (
831  const LagrangianInjection& injection,
834  const labelField& celli,
835  const labelField& facei,
836  const labelField& faceTrii,
837  const FieldNamesAndFields& ... fieldNamesAndFields
838  );
839 
840  //- As above but creates and returns the sub-mesh
841  template<class ... FieldNamesAndFields>
843  (
844  const LagrangianInjection& injection,
846  const labelField& celli,
847  const labelField& facei,
848  const labelField& faceTrii,
849  const FieldNamesAndFields& ... fieldNamesAndFields
850  );
851 
852  //- Return the sub-mesh associated with birthing a given number of
853  // elements
854  LagrangianSubMesh birthMesh(const label n) const;
855 
856  //- Birth specified elements into the mesh. Fields are expanded
857  // accordingly. New field values can be specified manually by
858  // providing alternating name and field arguments. Values for
859  // other fields will be mapped from the parent elements.
860  template<class ... FieldNamesAndFields>
861  void birth
862  (
864  const labelList& parents,
865  const FieldNamesAndFields& ... fieldNamesAndFields
866  );
867 
868  //- As above but creates and returns the sub-mesh
869  template<class ... FieldNamesAndFields>
871  (
872  const labelList& parents,
873  const FieldNamesAndFields& ... fieldNamesAndFields
874  );
875 
876  //- Reset the mesh to the old-time conditions
877  void reset(const bool initial, const bool final);
878 
879  //- Clear all geometry out of the Lagrangian mesh
880  void clear();
881 
882 
883  // Advanced Modify
884 
885  //- Manually partition a sub-set of the mesh given a list of
886  // element-group pairs. Elements not given a group will remain in
887  // a block at the start of the mesh. Elements with multiple groups
888  // will be placed in the block associated with the group with the
889  // largest index. Return offsets to the blocks.
891  (
892  const label nGroups,
893  const UList<labelPair>& elementsGroups
894  );
895 
896  //- As above but for enumerated groups
897  template<class Enumeration>
899  (
900  const label nGroups,
901  const UList<elementGroup<Enumeration>>& elementsGroups
902  );
903 
904  //- Remove specified elements from the mesh. Shuffles everything
905  // else up.
906  void remove(const UList<label>& elements);
907 
908  //- Remove a specified number of elements from the end of the mesh.
909  void remove(const label nElements);
910 
911 
912  // Mesh changes
913 
914  //- Clear the positions uses during mapping
915  virtual void clearPosition();
916 
917  //- Store the positions for use during mapping
918  virtual void storePosition();
919 
920  //- Update topology using the given map
921  virtual void topoChange(const polyTopoChangeMap&);
922 
923  //- Update from another mesh using the given map
924  virtual void mapMesh(const polyMeshMap&);
925 
926  //- Redistribute or update using the given distribution map
927  virtual void distribute(const polyDistributionMap&);
928 
929 
930  // Write
931 
932  //- Write using given format, version and compression
933  virtual bool writeObject
934  (
938  const bool write = true
939  ) const;
940 
941  //- Write settings from the database
942  virtual bool write(const bool write = true) const;
943 
944 
945  // Member Operators
946 
947  //- Disallow default bitwise assignment
948  void operator=(const LagrangianMesh&) = delete;
949 };
950 
951 
952 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
953 
954 } // End namespace Foam
955 
956 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
957 
958 #include "LagrangianMeshI.H"
959 
960 #ifdef NoRepository
961  #include "LagrangianMeshTemplates.C"
962 #endif
963 
964 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
965 
966 #endif
967 
968 // ************************************************************************* //
label n
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Pre-declare SubField and related Field type.
Definition: Field.H:83
A HashTable with keys but without contents.
Definition: HashSet.H:62
An STL-conforming hash table.
Definition: HashTable.H:127
friend Ostream & operator(Ostream &, const HashTable< regIOobject *, word, string::hash > &)
readOption
Enumeration defining the read options.
Definition: IOobject.H:117
word group() const
Return group (extension part of name)
Definition: IOobject.C:321
const word & name() const
Return name.
Definition: IOobject.H:307
writeOption
Enumeration defining the write options.
Definition: IOobject.H:126
Version number type.
Definition: IOstream.H:97
streamFormat
Enumeration for the format of data in the stream.
Definition: IOstream.H:87
compressionType
Enumeration for the format of data in the stream.
Definition: IOstream.H:194
Boundary part of a Lagrangian mesh. Just a list of Lagrangian patches with some added convenience fun...
Base class for Lagrangian source conditions.
Base class for Lagrangian injections. Minimal wrapper over LagrangianSource. Implements some utility ...
Class to define the scope of Lagrangian mesh state changes.
changer(LagrangianMesh &mesh, const LagrangianState state)
Construct for a Lagrangian mesh with a given state.
Class to hold element-group indices, and associate the group.
Class to hold and index into the field references associated with a.
const vector & operator()(const label i) const
The displacement for a given index.
linearDisplacement(const LagrangianSubVectorField &linear)
Construct from a reference to the displacement.
Class to hold and index into the field references associated with a.
Pair< vector > operator()(const label i) const
The displacements for a given index.
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.
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 objectRegistry & db() const
Return database.
const labelIODynamicField & faceTrii() const
Access the face-tet indices.
const LagrangianSubMesh & subAll() const
Return a sub-mesh for all elements.
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.
bool changing() const
Return whether or not the mesh is changing.
virtual void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
tmp< LagrangianInternalVectorField > position() const
Return the global positions.
uint64_t subMeshIndex() const
Get a sub-mesh index.
static const NamedEnum< permutationAlgorithm, 2 > permutationAlgorithmNames_
Permutation algorithm names.
LagrangianBoundaryMesh BoundaryMesh
Boundary mesh type.
~LagrangianMesh()
Destructor.
ClassName("LagrangianMesh")
Run-time type information.
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.
LagrangianSubMesh subNone() const
Return a sub-mesh for no elements.
LagrangianSubMesh subIncomplete() const
Return a sub-mesh for all incomplete elements.
HashTable< const GeoField * > lookupCurrentFields(const bool strict=false) const
Lookup all current-time fields of the given type.
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.
label nStates() const
Return the number of states.
const polyMesh & poly() const
Access the poly mesh.
LagrangianMesh Mesh
Mesh type.
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 birth(const LagrangianSubMesh &birthMesh, const labelList &parents, const FieldNamesAndFields &... fieldNamesAndFields)
Birth specified elements into the mesh. Fields are expanded.
void inject(const LagrangianSubMesh &injectionMesh, const barycentricField &coordinates, const labelField &celli, const labelField &facei, const labelField &faceTrii, const FieldNamesAndFields &... fieldNamesAndFields)
Inject specified elements into the mesh. This method does not.
void operator=(const LagrangianMesh &)=delete
Disallow default bitwise assignment.
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.
label globalSize() const
Get the global number of elements.
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.
Base class for Lagrangian boundary conditions.
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...
An ordered pair of two objects of type <Type> with first() and second() elements.
Definition: Pair.H:67
const label & second() const
Return second.
Definition: PairI.H:121
const label & first() const
Return first.
Definition: PairI.H:107
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
Centred interpolation interpolation scheme class.
Definition: linear.H:53
A non-conformal cyclic boundary condition for Lagrangian. Properties are transformed by the transform...
Registry of regIOobjects.
const Time & time() const
Return time.
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Class containing mesh-to-mesh mapping information.
Definition: polyMeshMap.H:51
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:78
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
A processor boundary condition for Lagrangian. Properties are communicated to and from the neighbour ...
Processor Lagrangian patch. This is used for the patches that interface between processors across fac...
A class for managing temporary objects.
Definition: tmp.H:55
A class for handling words, derived from string.
Definition: word.H:63
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
const unitSet fraction
Namespace for OpenFOAM.
const doubleScalar e
Definition: doubleScalar.H:106
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
LagrangianState
Lagrangian state enumeration.
LagrangianGroup
Lagrangian group enumeration.
labelList f(nPoints)