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-------------------------------------------------------------------------------
11License
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,
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// ************************************************************************* //
virtual label index() const
virtual const lduInterfacePtrsList & coarseInterfaces() const
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:64
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
Definition: Time.C:717
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
An abstract base class for implicitly-coupled interfaces e.g. processor and cyclic patches.
Definition: lduInterface.H:58
A class for handling words, derived from Foam::string.
Definition: word.H:68
#define FatalErrorInLookup(lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalError.
Definition: error.H:457
error FatalError
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130