renumberMethod.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2015 OpenFOAM Foundation
9  Copyright (C) 2019-2021 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 InClass
28  renumberMethod
29 
30 \*---------------------------------------------------------------------------*/
31 
32 #include "renumberMethod.H"
33 #include "decompositionMethod.H"
34 
35 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
36 
37 namespace Foam
38 {
41 }
42 
43 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
44 
46 (
47  const dictionary& dict
48 )
49 {
50  const word methodType(dict.get<word>("method"));
51 
52  //Info<< "Selecting renumberMethod " << methodType << endl;
53 
54  auto* ctorPtr = dictionaryConstructorTable(methodType);
55 
56  if (!ctorPtr)
57  {
59  (
60  dict,
61  "renumberMethod",
62  methodType,
63  *dictionaryConstructorTablePtr_
64  ) << exit(FatalIOError);
65  }
66 
67  return autoPtr<renumberMethod>(ctorPtr(dict));
68 }
69 
70 
72 (
73  const polyMesh& mesh,
74  const pointField& points
75 ) const
76 {
77  CompactListList<label> cellCells;
79  (
80  mesh,
81  identity(mesh.nCells()),
82  mesh.nCells(),
83  false, // local only
84  cellCells
85  );
86 
87  // Renumber based on agglomerated points
88  return renumber(cellCells(), points);
89 }
90 
91 
93 (
94  const labelList& cellCells,
95  const labelList& offsets,
96  const pointField& cc
97 ) const
98 {
100  return labelList();
101 }
102 
103 
105 (
106  const polyMesh& mesh,
107  const labelList& fineToCoarse,
108  const pointField& coarsePoints
109 ) const
110 {
111  CompactListList<label> coarseCellCells;
113  (
114  mesh,
115  fineToCoarse,
116  coarsePoints.size(),
117  false, // local only
118  coarseCellCells
119  );
120 
121  // Renumber based on agglomerated points
122  labelList coarseDistribution
123  (
124  renumber
125  (
126  coarseCellCells(),
127  coarsePoints
128  )
129  );
130 
131  // Rework back into renumbering for original mesh_
132  labelList fineDistribution(fineToCoarse.size());
133 
134  forAll(fineDistribution, i)
135  {
136  fineDistribution[i] = coarseDistribution[fineToCoarse[i]];
137  }
138 
139  return fineDistribution;
140 }
141 
142 
143 // ************************************************************************* //
Foam::labelList
List< label > labelList
A List of labels.
Definition: List.H:63
Foam::pointField
vectorField pointField
pointField is a vectorField.
Definition: pointFieldFwd.H:38
Foam::decompositionMethod::calcCellCells
static void calcCellCells(const polyMesh &mesh, const labelList &agglom, const label nLocalCoarse, const bool global, CompactListList< label > &cellCells)
Definition: decompositionMethod.C:461
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:63
Foam::defineRunTimeSelectionTable
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
Foam::CompactListList
A packed storage unstructured matrix of objects of type <T> using an offset table for access.
Definition: CompactListList.H:59
Foam::FatalIOError
IOerror FatalIOError
decompositionMethod.H
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:73
forAll
#define forAll(list, i)
Definition: stdFoam.H:349
NotImplemented
#define NotImplemented
Definition: error.H:553
Foam::renumberMethod::renumber
virtual labelList renumber(const pointField &) const
Definition: renumberMethod.H:113
Foam::primitiveMesh::nCells
label nCells() const noexcept
Definition: primitiveMeshI.H:89
FatalIOErrorInLookup
#define FatalIOErrorInLookup(ios, lookupTag, lookupName, lookupTable)
Definition: error.H:502
renumberMethod.H
Foam::Field
Generic templated field type.
Definition: Field.H:59
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:119
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam
Definition: atmBoundaryLayer.C:26
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:125
Foam::renumberMethod
Abstract base class for renumbering.
Definition: renumberMethod.H:46
Foam::autoPtr< Foam::renumberMethod >
Foam::renumber
IntListType renumber(const labelUList &oldToNew, const IntListType &input)
Definition: ListOpsTemplates.C:30
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: BitOps.H:58
points
const pointField & points
Definition: gmvOutputHeader.H:1
Foam::identity
labelList identity(const label len, label start=0)
Definition: labelList.C:31
Foam::renumberMethod::New
static autoPtr< renumberMethod > New(const dictionary &renumberDict)
Definition: renumberMethod.C:39
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)