Loading...
Searching...
No Matches
ITHACAparallel.H
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ██╗████████╗██╗ ██╗ █████╗ ██████╗ █████╗ ███████╗██╗ ██╗
3 ██║╚══██╔══╝██║ ██║██╔══██╗██╔════╝██╔══██╗ ██╔════╝██║ ██║
4 ██║ ██║ ███████║███████║██║ ███████║█████╗█████╗ ██║ ██║
5 ██║ ██║ ██╔══██║██╔══██║██║ ██╔══██║╚════╝██╔══╝ ╚██╗ ██╔╝
6 ██║ ██║ ██║ ██║██║ ██║╚██████╗██║ ██║ ██║ ╚████╔╝
7 ╚═╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚═══╝
8
9 * In real Time Highly Advanced Computational Applications for Finite Volumes
10 * Copyright (C) 2017 by the ITHACA-FV authors
11-------------------------------------------------------------------------------
12License
13 This file is part of ITHACA-FV
14 ITHACA-FV is free software: you can redistribute it and/or modify
15 it under the terms of the GNU Lesser 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 ITHACA-FV is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU Lesser General Public License for more details.
22 You should have received a copy of the GNU Lesser General Public License
23 along with ITHACA-FV. If not, see <http://www.gnu.org/licenses/>.
24Class
25 ITHACAparallel
26Description
27 Methods for to deal with parallel computations
28SourceFiles
29 ITHACAparallel.C
30\*---------------------------------------------------------------------------*/
31#ifndef ITHACAparallel_H
32#define ITHACAparallel_H
33#include "fvCFD.H"
34#include "ITHACAassert.H"
35
36
40{
46 ITHACAparallel(fvMesh& mesh, Time& localTime);
47
49 static ITHACAparallel* instance;
50
51 public:
60 static ITHACAparallel* getInstance(fvMesh& mesh, Time& localTime);
61
68
70 ITHACAparallel() = delete;
71
73 static void suspendMPI();
74
76 static void resumeMPI();
77
79 template<class Type>
80 List<List <Type>> combineFields(GeometricField<Type, fvPatchField, volMesh>&
81 field);
82
83 template<class type>
84 GeometricField<type, fvPatchField, volMesh> constructGlobalField(
85 GeometricField<type, fvPatchField, volMesh> field);
86
88 label N_IF_glob;
89
91 label N_BF;
92
94 autoPtr<labelIOList> indices;
95
97 autoPtr<labelIOList> indicesF;
98
100 autoPtr<labelList> Gsize_BF;
101
103 autoPtr< List<labelList>> IndFaceLocal;
104
106 autoPtr<labelList> Lsize_BF;
107
109 autoPtr<labelList> Start;
110
112 static List<int> oldProcIDs_;
113
115 static List<int> newProcIDs_;
116
118 Time& runTime;
119
121 fvMesh& mesh;
122
123};
124
125template<>
127 GeometricField<scalar, fvPatchField, volMesh>& field);
128
129template<class type>
130GeometricField<type, fvPatchField, volMesh>
131ITHACAparallel::constructGlobalField(GeometricField<type, fvPatchField, volMesh>
132 field)
133{
134 autoPtr<Time> globalTimePtr_;
135 autoPtr<fvMesh> globalMeshPtr_;
136 Time& localTime = runTime;
137 fvMesh& localMesh = mesh;
138 const word globalConstant = localTime.rootPath() + "/" +
139 localTime.globalCaseName() + "/constant";
140 const fileName gRootPath = localTime.rootPath();
141 const fileName gCaseName = localTime.globalCaseName();
142 globalTimePtr_.reset
143 (
144 new Time
145 (
146 gRootPath,
147 gCaseName
148 )
149 );
150 Time& globalTime = globalTimePtr_();
151 globalMeshPtr_.reset
152 (
153 new fvMesh
154 (
155 IOobject
156 (
157 fvMesh::defaultRegion,
158 globalTime.timeName(),
159 globalTime,
160 IOobject::MUST_READ
161 )
162 )
163 );
164 GeometricField<type, fvPatchField, volMesh> F_glob
165 (
166 IOobject
167 (
168 field.name(),
169 globalTimePtr_().timeName(),
170 globalMeshPtr_(),
171 IOobject::MUST_READ,
172 IOobject::AUTO_WRITE
173 ),
174 globalMeshPtr_()
175 );
176 return F_glob;
177}
178#endif
179
180
Implementation of the assert function for ITHACA-FV.
Class for parallel handling, it has several functions to deal with parallel problems,...
autoPtr< labelList > Start
StartFace on the gloabl Mesh.
autoPtr< labelIOList > indices
Cell proc addressing.
autoPtr< List< labelList > > IndFaceLocal
Indexing.
static void suspendMPI()
Function to sumpend MPI.
fvMesh & mesh
Mesh object defined locally.
ITHACAparallel()=delete
Delete empty constructor.
static ITHACAparallel * getInstance()
Gets an instance of ithacaparallel, to be used if the instance is already existing.
GeometricField< type, fvPatchField, volMesh > constructGlobalField(GeometricField< type, fvPatchField, volMesh > field)
Time & runTime
runTime defined locally
static void resumeMPI()
Function to resume MPI.
label N_IF_glob
Totoal number of internal field cells.
static List< int > newProcIDs_
ID of the NEW process.
autoPtr< labelIOList > indicesF
Face proc addressing.
static List< int > oldProcIDs_
ID of the OLD process.
autoPtr< labelList > Gsize_BF
Boundary Field variables representing the total number of faces for each processor.
List< List< Type > > combineFields(GeometricField< Type, fvPatchField, volMesh > &field)
Function to get a global field from a parallel one.
label N_BF
Number of Boundary Patches without considering processors.
autoPtr< labelList > Lsize_BF
Local size at the boundary.