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 {
39  defineTypeNameAndDebug(renumberMethod, 0);
40  defineRunTimeSelectionTable(renumberMethod, dictionary);
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;
78  decompositionMethod::calcCellCells
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;
112  decompositionMethod::calcCellCells
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:67
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
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:63
Foam::FatalIOError
IOerror FatalIOError
decompositionMethod.H
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:296
NotImplemented
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:517
Foam::renumberMethod::renumber
virtual labelList renumber(const pointField &) const
Return the order in which cells need to be visited, i.e.
Definition: renumberMethod.H:117
FatalIOErrorInLookup
#define FatalIOErrorInLookup(ios, lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalIOError.
Definition: error.H:478
renumberMethod.H
Foam::Field< vector >
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:123
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
Foam::autoPtr< Foam::renumberMethod >
Foam::renumber
IntListType renumber(const labelUList &oldToNew, const IntListType &input)
Renumber the values (not the indices) of a list.
Definition: ListOpsTemplates.C:37
Foam::List< label >
points
const pointField & points
Definition: gmvOutputHeader.H:1
Foam::identity
labelList identity(const label len, label start=0)
Create identity map of the given length with (map[i] == i)
Definition: labelList.C:38
Foam::renumberMethod::New
static autoPtr< renumberMethod > New(const dictionary &renumberDict)
Return a reference to the selected renumbering method.
Definition: renumberMethod.C:46
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)