Loading...
Searching...
No Matches
interface.hpp
1/*---------------------------------------------------------------------------*\
2 *
3 * bitpit
4 *
5 * Copyright (C) 2015-2021 OPTIMAD engineering Srl
6 *
7 * -------------------------------------------------------------------------
8 * License
9 * This file is part of bitpit.
10 *
11 * bitpit is free software: you can redistribute it and/or modify it
12 * under the terms of the GNU Lesser General Public License v3 (LGPL)
13 * as published by the Free Software Foundation.
14 *
15 * bitpit is distributed in the hope that it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
18 * License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with bitpit. If not, see <http://www.gnu.org/licenses/>.
22 *
23\*---------------------------------------------------------------------------*/
24
25#ifndef __BITPIT_INTERFACE_HPP__
26#define __BITPIT_INTERFACE_HPP__
27
28#include <array>
29#include <memory>
30
31#include "bitpit_containers.hpp"
32
33#include "element.hpp"
34
35namespace bitpit {
36
37class Interface : public Element {
38
39public:
40 Interface();
41 Interface(long id, ElementType type = ElementType::UNDEFINED);
42 Interface(long id, ElementType type, int connectSize = 0);
43 Interface(long id, ElementType type, std::unique_ptr<long[]> &&connectStorage);
44
45 void swap(Interface &other) noexcept;
46
47 void initialize(long id, ElementType type);
48 void initialize(long id, ElementType type, int connectSize);
49 void initialize(long id, ElementType type, std::unique_ptr<long[]> &&connectStorage);
50
51 bool isBorder() const;
52
53 static std::array<std::array<double, 3>, 3> evalRotationFromCartesian(std::array<double, 3> &versor);
54 static std::array<std::array<double, 3>, 3> evalRotationToCartesian(std::array<double, 3> &versor);
55 static std::array<std::array<double, 3>, 3> evalRotationInverse(const std::array<std::array<double, 3>, 3> &R);
56 static std::array<std::array<double, 3>, 3> evalRotationTranspose(const std::array<std::array<double, 3>, 3> &R);
57
58 void setOwner(long owner, int onwerFace);
59 void unsetOwner();
60 long getOwner() const;
61 int getOwnerFace() const;
62
63 void setNeigh(long neigh, int neighFace);
64 void unsetNeigh();
65 long getNeigh() const;
66 int getNeighFace() const;
67
68 std::array<long, 2> getOwnerNeigh() const;
69
70 void display(std::ostream &out, unsigned short int indent) const;
71
72private:
73 long m_owner;
74 long m_neigh;
75
76 int m_ownerFace;
77 int m_neighFace;
78
79 void _initialize(long owner, long ownerFace, long neigh, long neighFace);
80
81};
82
83template<typename QualifiedInterface>
84class QualifiedInterfaceHalfEdge : public ElementHalfFace<QualifiedInterface> {
85
86public:
87 typedef typename ElementHalfFace<QualifiedInterface>::Winding Winding;
88
89 QualifiedInterfaceHalfEdge(QualifiedInterface &interface, int edge, Winding winding = Winding::WINDING_NATURAL);
90
91 QualifiedInterface & getInterface() const;
92
93};
94
95extern template class PiercedVector<Interface>;
96
97extern template class QualifiedInterfaceHalfEdge<Interface>;
99
102
103
104}
105
106// Include template implementations
107#include "interface.tpp"
108
109#endif
The ElementHalfFace class defines element half-faces.
Definition element.hpp:272
The Element class provides an interface for defining elements.
Definition element.hpp:46
The Interface class defines the interfaces among cells.
Definition interface.hpp:37
long getNeigh() const
static std::array< std::array< double, 3 >, 3 > evalRotationInverse(const std::array< std::array< double, 3 >, 3 > &R)
void setOwner(long owner, int onwerFace)
long getOwner() const
void initialize(long id, ElementType type)
void setNeigh(long neigh, int neighFace)
bool isBorder() const
std::array< long, 2 > getOwnerNeigh() const
int getOwnerFace() const
static std::array< std::array< double, 3 >, 3 > evalRotationTranspose(const std::array< std::array< double, 3 >, 3 > &R)
static std::array< std::array< double, 3 >, 3 > evalRotationToCartesian(std::array< double, 3 > &versor)
void swap(Interface &other) noexcept
static std::array< std::array< double, 3 >, 3 > evalRotationFromCartesian(std::array< double, 3 > &versor)
int getNeighFace() const
void display(std::ostream &out, unsigned short int indent) const
Metafunction for generating a pierced vector.
The QualifiedInterfaceHalfEdge class defines interface half-edges.
Definition interface.hpp:84
QualifiedInterface & getInterface() const
Definition interface.tpp:61
QualifiedInterfaceHalfEdge(QualifiedInterface &interface, int edge, Winding winding=Winding::WINDING_NATURAL)
Definition interface.tpp:50
--- layout: doxygen_footer ---