-
-
Notifications
You must be signed in to change notification settings - Fork 106
Expand file tree
/
Copy pathCouplingDataUser.C
More file actions
90 lines (77 loc) · 2.34 KB
/
CouplingDataUser.C
File metadata and controls
90 lines (77 loc) · 2.34 KB
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
#include "CouplingDataUser.H"
preciceAdapter::CouplingDataUser::CouplingDataUser()
{
}
bool preciceAdapter::CouplingDataUser::hasScalarData()
{
return dataType_ == scalar;
}
bool preciceAdapter::CouplingDataUser::hasVectorData()
{
return dataType_ == vector;
}
void preciceAdapter::CouplingDataUser::setDataName(std::string dataName)
{
dataName_ = std::move(dataName);
}
const std::string& preciceAdapter::CouplingDataUser::dataName()
{
return dataName_;
}
void preciceAdapter::CouplingDataUser::setFlipNormal(bool flipNormal)
{
flipNormal_ = flipNormal;
}
void preciceAdapter::CouplingDataUser::applyFlipNormal(precice::span<double> dataBuffer)
{
if (flipNormal_)
{
for (double& val : dataBuffer)
{
val *= -1.0;
}
}
}
void preciceAdapter::CouplingDataUser::setPatchIDs(std::vector<int> patchIDs)
{
patchIDs_ = patchIDs;
}
void preciceAdapter::CouplingDataUser::setCellSetNames(std::vector<std::string> cellSetNames)
{
cellSetNames_ = cellSetNames;
}
void preciceAdapter::CouplingDataUser::setLocationsType(LocationType locationsType)
{
locationType_ = locationsType;
}
void preciceAdapter::CouplingDataUser::checkDataLocation(const bool meshConnectivity) const
{
if (this->isLocationTypeSupported(meshConnectivity) == false)
{
std::string location("none");
if (locationType_ == LocationType::faceCenters)
location = "faceCenters";
else if (locationType_ == LocationType::faceNodes)
location = "faceNodes";
else if (locationType_ == LocationType::volumeCenters)
location = "volumeCenters";
if (meshConnectivity)
{
adapterInfo("The data \"" + getDataName() + "\""
+ " does not currently support mesh connectivity (e.g., nearest-projection mapping) for location type "
+ "\"" + location + "\".",
"error");
}
else
{
adapterInfo("The data \"" + getDataName() + "\" does not support location type \""
+ location + "\". Please select a different location type.",
"error");
}
}
}
// Dummy implementation which can be overwritten in derived classes if required
void preciceAdapter::CouplingDataUser::initialize()
{
return;
}