Chi-Tech
RPPLogicalVolume.cc
Go to the documentation of this file.
1#include "RPPLogicalVolume.h"
2
3#include "ChiObjectFactory.h"
4
5namespace chi_mesh
6{
7
9
11{
13
14 params.SetDocGroup("LuaLogicVolumes");
15
16 params.AddOptionalParameter("xmin", 0.0, "X-min of the volume");
17 params.AddOptionalParameter("xmax", 1.0, "X-max of the volume");
18 params.AddOptionalParameter("ymin", 0.0, "Y-min of the volume");
19 params.AddOptionalParameter("ymax", 1.0, "Y-max of the volume");
20 params.AddOptionalParameter("zmin", 0.0, "Z-min of the volume");
21 params.AddOptionalParameter("zmax", 1.0, "Z-max of the volume");
22
24 "infx", false, "Flag, when true, will ignore xmin and xmax.");
26 "infy", false, "Flag, when true, will ignore ymin and ymax.");
28 "infz", false, "Flag, when true, will ignore zmin and zmax.");
29
30 return params;
31}
32
34 : LogicalVolume(params),
35 xmin_(params.GetParamValue<double>("xmin")),
36 xmax_(params.GetParamValue<double>("xmax")),
37 ymin_(params.GetParamValue<double>("ymin")),
38 ymax_(params.GetParamValue<double>("ymax")),
39 zmin_(params.GetParamValue<double>("zmin")),
40 zmax_(params.GetParamValue<double>("zmax")),
41 infx_(params.GetParamValue<bool>("infx")),
42 infy_(params.GetParamValue<bool>("infy")),
43 infz_(params.GetParamValue<bool>("infz"))
44{
45}
46
47#define XMAX 0
48#define XMIN 1
49#define YMAX 2
50#define YMIN 3
51#define ZMAX 4
52#define ZMIN 5
53
55{
56 constexpr std::array<bool, 6> true_condition = {
57 true, true, true, true, true, true};
58 std::array<bool, 6> condition = {false, false, false, false, false, false};
59
60 if (point.x <= xmax_ or infx_) condition[XMAX] = true;
61 if (point.x >= xmin_ or infx_) condition[XMIN] = true;
62 if (point.y <= ymax_ or infy_) condition[YMAX] = true;
63 if (point.y >= ymin_ or infy_) condition[YMIN] = true;
64 if (point.z <= zmax_ or infz_) condition[ZMAX] = true;
65 if (point.z >= zmin_ or infz_) condition[ZMIN] = true;
66
67 return condition == true_condition;
68}
69
70} // namespace chi_mesh
#define XMAX
#define ZMAX
#define YMAX
#define XMIN
#define YMIN
#define ZMIN
void SetDocGroup(const std::string &doc_group)
void AddOptionalParameter(const std::string &name, T value, const std::string &doc_string)
static chi::InputParameters GetInputParameters()
Definition: LogicalVolume.cc:6
static chi::InputParameters GetInputParameters()
bool Inside(const chi_mesh::Vector3 &point) const override
RPPLogicalVolume(const chi::InputParameters &params)
RegisterChiObject(chi_mesh, BooleanLogicalVolume)
double x
Element-0.
double y
Element-1.
double z
Element-2.