-
Notifications
You must be signed in to change notification settings - Fork 1k
/
MultiAppTransfer.h
117 lines (95 loc) · 3.45 KB
/
MultiAppTransfer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
//* This file is part of the MOOSE framework
//* https://www.mooseframework.org
//*
//* All rights reserved, see COPYRIGHT for full restrictions
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
//*
//* Licensed under LGPL 2.1, please see LICENSE for details
//* https://www.gnu.org/licenses/lgpl-2.1.html
#ifndef MULTIAPPTRANSFER_H
#define MULTIAPPTRANSFER_H
// MOOSE includes
#include "Transfer.h"
#include "MooseEnum.h"
#include "libmesh/bounding_box.h"
// Forward declarations
class MultiAppTransfer;
class MooseMesh;
class MultiApp;
template <>
InputParameters validParams<MultiAppTransfer>();
/**
* Base class for all MultiAppTransfer objects.
*
* MultiAppTransfers are objects that push and pull values to and from
* MultiApp objects from and to the main (master) system.
*
* Classes that inherit from this class still need to override the
* execute() method from Transfer.
*/
class MultiAppTransfer : public Transfer
{
public:
MultiAppTransfer(const InputParameters & parameters);
enum DIRECTION
{
TO_MULTIAPP,
FROM_MULTIAPP
};
/// Used to construct InputParameters
static MooseEnum directions() { return MooseEnum("to_multiapp from_multiapp"); }
/// The direction this Transfer is going in
int direction() { return _direction; }
/**
* Utility to verify that the vEariable in the destination system exists.
*/
void variableIntegrityCheck(const AuxVariableName & var_name) const;
/// Return the MultiApp that this transfer belongs to
const std::shared_ptr<MultiApp> getMultiApp() const { return _multi_app; }
/// Return the execution flags, handling "same_as_multiapp"
virtual const std::vector<ExecFlagType> & execFlags() const;
protected:
/// The MultiApp this Transfer is transferring data to or from
std::shared_ptr<MultiApp> _multi_app;
/// Whether we're transferring to or from the MultiApp
MooseEnum _direction;
/**
* This method will fill information into the convenience member variables
* (_to_problems, _from_meshes, etc.)
*/
void getAppInfo();
std::vector<FEProblemBase *> _to_problems;
std::vector<FEProblemBase *> _from_problems;
std::vector<EquationSystems *> _to_es;
std::vector<EquationSystems *> _from_es;
std::vector<MooseMesh *> _to_meshes;
std::vector<MooseMesh *> _from_meshes;
std::vector<Point> _to_positions;
std::vector<Point> _from_positions;
/// True if displaced mesh is used for the source mesh, otherwise false
bool _displaced_source_mesh;
/// True if displaced mesh is used for the target mesh, otherwise false
bool _displaced_target_mesh;
///@{
/**
* Return the bounding boxes of all the "from" domains, including all the domains not local to
* this processor. The is a boundary restricted version which will return a degenerate minimum
* boundary box (min, min, min, min, min, min) in the case where the source domain doesn't
* have any active nodes on the boundary.
*/
std::vector<BoundingBox> getFromBoundingBoxes();
std::vector<BoundingBox> getFromBoundingBoxes(BoundaryID boundary_id);
///@}
/**
* Return the number of "from" domains that each processor owns.
*/
std::vector<unsigned int> getFromsPerProc();
/**
* If we are transferring to a multiapp, return the appropriate solution
* vector
*/
NumericVector<Real> & getTransferVector(unsigned int i_local, std::string var_name);
// Given local app index, returns global app index.
std::vector<unsigned int> _local2global_map;
};
#endif /* MULTIAPPTRANSFER_H */