PLaSK library
Loading...
Searching...
No Matches
basic.hpp
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
#ifndef PLASK__MESH__BASIC_H
15
#define PLASK__MESH__BASIC_H
16
22
#include "
mesh.hpp
"
23
24
namespace
plask
{
25
27
template
<
int
DIM>
28
struct
PLASK_API
OnePointMesh
:
public
plask::MeshD
<DIM> {
29
30
typedef
Vec<DIM, double>
DVec
;
31
33
DVec
point
;
34
35
OnePointMesh
(
const
plask::Vec<DIM, double>
& point)
36
: point(point) {}
37
38
// plask::MeshD<DIM> methods implementation:
39
40
std::size_t size()
const override
;
41
42
DVec at(std::size_t index)
const override
;
43
44
void
writeXML
(
XMLElement
&
object
)
const override
;
45
46
};
47
53
template
<
int
DIM>
54
inline
shared_ptr<OnePointMesh<DIM>
>
toMesh
(
const
plask::Vec<DIM, double>
& point) {
55
return
plask::make_shared<OnePointMesh<DIM>
>(point);
56
}
57
58
template
<>
void
OnePointMesh<2>::writeXML
(
XMLElement
&
object
)
const
;
59
template
<>
void
OnePointMesh<3>::writeXML
(
XMLElement
&
object
)
const
;
60
61
PLASK_API_EXTERN_TEMPLATE_STRUCT
(
OnePointMesh<2>
)
62
PLASK_API_EXTERN_TEMPLATE_STRUCT
(
OnePointMesh<3>
)
63
64
67
template
<
int
DIM>
68
struct
PLASK_API
TranslatedMesh
:
public
MeshD
<DIM> {
69
70
typedef
Vec<DIM, double>
DVec
;
71
72
DVec
translation
;
73
74
const
shared_ptr<const MeshD<DIM>
>
sourceMesh
;
75
76
TranslatedMesh
(
const
shared_ptr<
const
MeshD<DIM>
>& sourceMesh,
const
Vec<DIM, double>
& translation)
77
: translation(translation), sourceMesh(sourceMesh) {}
78
79
DVec at(std::size_t index)
const override
;
80
81
std::size_t size()
const override
;
82
83
};
84
85
PLASK_API_EXTERN_TEMPLATE_STRUCT
(
TranslatedMesh<2>
)
86
PLASK_API_EXTERN_TEMPLATE_STRUCT
(
TranslatedMesh<3>
)
87
88
//TODO return special type for rectangular meshes
89
template
<
int
DIM>
90
inline
shared_ptr<TranslatedMesh<DIM>
>
translate
(
const
shared_ptr<
const
MeshD<DIM>
>& sourceMesh,
const
Vec<DIM, double>
& translation) {
91
return
plask::make_shared<TranslatedMesh<DIM>
>(sourceMesh, translation);
92
}
93
94
}
// namespace plask
95
96
#endif
// PLASK__MESH__BASIC_H
plask
mesh
basic.hpp
Generated by
1.9.8