GAMGInterfaceNew.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 \*---------------------------------------------------------------------------*/
28 
29 #include "GAMGInterface.H"
30 #include "GAMGAgglomeration.H"
31 #include "lduMatrix.H"
32 
33 
34 // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
35 
37 (
38  const label index,
39  const lduInterfacePtrsList& coarseInterfaces,
40  const lduInterface& fineInterface,
41  const labelField& localRestrictAddressing,
42  const labelField& neighbourRestrictAddressing,
43  const label fineLevelIndex,
44  const label coarseComm
45 )
46 {
47  const word coupleType(fineInterface.type());
48 
49  auto* ctorPtr = lduInterfaceConstructorTable(coupleType);
50 
51  if (!ctorPtr)
52  {
54  (
55  "GAMGInterface",
56  coupleType,
57  *lduInterfaceConstructorTablePtr_
58  ) << exit(FatalError);
59  }
60 
62  (
63  ctorPtr
64  (
65  index,
66  coarseInterfaces,
67  fineInterface,
68  localRestrictAddressing,
69  neighbourRestrictAddressing,
70  fineLevelIndex,
71  coarseComm
72  )
73  );
74 }
75 
76 
78 (
79  const word& coupleType,
80  const label index,
81  const lduInterfacePtrsList& coarseInterfaces,
82  Istream& is
83 )
84 {
85  auto* ctorPtr = IstreamConstructorTable(coupleType);
86 
87  if (!ctorPtr)
88  {
90  (
91  "GAMGInterface",
92  coupleType,
93  *IstreamConstructorTablePtr_
94  ) << exit(FatalError);
95  }
96 
97  return autoPtr<GAMGInterface>(ctorPtr(index, coarseInterfaces, is));
98 }
99 
100 
101 // ************************************************************************* //
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::lduInterface
An abstract base class for implicitly-coupled interfaces e.g. processor and cyclic patches.
Definition: lduInterface.H:54
GAMGAgglomeration.H
lduMatrix.H
GAMGInterface.H
Foam::Field< label >
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::UPtrList< const lduInterface >
Foam::FatalError
error FatalError
FatalErrorInLookup
#define FatalErrorInLookup(lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalError.
Definition: error.H:457
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::GAMGInterface::New
static autoPtr< GAMGInterface > New(const label index, const lduInterfacePtrsList &coarseInterfaces, const lduInterface &fineInterface, const labelField &localRestrictAddressing, const labelField &neighbourRestrictAddressing, const label fineLevelIndex, const label coarseComm)
Return a pointer to a new interface created on freestore given.
Definition: GAMGInterfaceNew.C:37