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
24namespace plask {
25
27template <int DIM>
28struct PLASK_API OnePointMesh: public plask::MeshD<DIM> {
29
31
34
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
53template <int DIM>
57
58template<> void OnePointMesh<2>::writeXML(XMLElement& object) const;
59template<> void OnePointMesh<3>::writeXML(XMLElement& object) const;
60
63
64
67template <int DIM>
68struct PLASK_API TranslatedMesh: public MeshD<DIM> {
69
71
73
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
87
88//TODO return special type for rectangular meshes
89template <int DIM>
90inline 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