PLaSK library
Loading...
Searching...
No Matches
rectangular3d.cpp
Go to the documentation of this file.
1
/*
2
* This file is part of PLaSK (https://plask.app) by Photonics Group at TUL
3
* Copyright (c) 2022 Lodz University of Technology
4
*
5
* This program is free software: you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation, version 3.
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*/
14
#include "
rectangular3d.hpp
"
15
16
#include "
regular1d.hpp
"
17
#include "
ordered1d.hpp
"
18
19
namespace
plask
{
20
21
22
shared_ptr<RectangularMesh3D::ElementMesh>
RectangularMesh3D::getElementMesh
()
const
{
23
return
plask::make_shared<RectangularMesh3D::ElementMesh>
(
this
,
axis
[0]->getMidpointAxis(),
axis
[1]->getMidpointAxis(),
axis
[2]->getMidpointAxis(),
getIterationOrder
());
24
}
25
26
RectangularMesh3D::RectangularMesh3D
(
IterationOrder
iterationOrder
):
RectilinearMesh3D
(
iterationOrder
) {}
27
28
RectangularMesh3D::RectangularMesh3D
(shared_ptr<MeshAxis>
mesh0
, shared_ptr<MeshAxis> mesh1, shared_ptr<MeshAxis> mesh2,
IterationOrder
iterationOrder
):
29
RectilinearMesh3D
(
std
::move(
mesh0
),
std
::move(mesh1),
std
::move(mesh2),
iterationOrder
) {}
30
31
RectangularMesh3D::RectangularMesh3D
(
const
RectangularMesh3D
& src,
bool
clone_axes
):
RectilinearMesh3D
(src,
clone_axes
) {}
32
33
void
RectangularMesh3D::writeXML
(
XMLElement
&
object
)
const
{
34
object
.attr(
"type"
,
"rectangular3d"
);
35
{
auto
a
=
object
.addTag(
"axis0"
);
axis
[0]->
writeXML
(
a
); }
36
{
auto
a
=
object
.addTag(
"axis1"
);
axis
[1]->writeXML(
a
); }
37
{
auto
a
=
object
.addTag(
"axis2"
);
axis
[2]->writeXML(
a
); }
38
}
39
40
shared_ptr<RectangularMesh3D>
make_rectangular_mesh
(
const
RectangularMesh3D
&
to_copy
) {
41
return
plask::make_shared<RectangularMesh3D>
(
42
plask::make_shared<OrderedAxis>
(*
to_copy
.axis[0]),
43
plask::make_shared<OrderedAxis>
(*
to_copy
.axis[1]),
44
plask::make_shared<OrderedAxis>
(*
to_copy
.axis[2]),
45
to_copy
.getIterationOrder()
46
);
47
}
48
49
static
shared_ptr<Mesh>
readRectangularMesh3D(XMLReader& reader) {
50
shared_ptr<MeshAxis> axis[3];
51
XMLReader::CheckTagDuplication
dub_check
;
52
for
(
int
i = 0; i < 3; ++i) {
53
reader.requireTag();
54
std::string
node
= reader.getNodeName();
55
if
(
node
!=
"axis0"
&&
node
!=
"axis1"
&&
node
!=
"axis2"
)
throw
XMLUnexpectedElementException(reader,
"<axis0>, <axis1> or <axis2>"
);
56
dub_check
(std::string(
"<mesh>"
),
node
);
57
axis[
node
[4]-
'0'
] =
readMeshAxis
(reader);
58
}
59
reader.requireTagEnd();
60
return
plask::make_shared<RectangularMesh3D>
(std::move(axis[0]), std::move(axis[1]), std::move(axis[2]));
61
}
62
63
static
RegisterMeshReader rectangular3d_reader(
"rectangular3d"
, readRectangularMesh3D);
64
65
}
// namespace plask
66
67
68
69
plask
mesh
rectangular3d.cpp
Generated by
1.9.8