Loading...
Searching...
No Matches
surface_kernel.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_SURFACE_KERNEL_HPP__
26#define __BITPIT_SURFACE_KERNEL_HPP__
27
28#include "patch_kernel.hpp"
29#include "line_kernel.hpp"
30
31#include "bitpit_common.hpp"
32
33namespace bitpit {
34
35class SurfaceKernel : public PatchKernel {
36
37public:
38 // Static constant
39 BITPIT_PUBLIC_API static const unsigned short SELECT_TRIANGLE;
40 BITPIT_PUBLIC_API static const unsigned short SELECT_QUAD;
41 BITPIT_PUBLIC_API static const unsigned short SELECT_ALL;
42
43 // Types definitions
44 typedef double (SurfaceKernel::*eval_f_)(long, int &) const;
45
46 void setSpaceDimension(int dimension);
47 int getSpaceDimension(void) const;
48
49 int getVolumeCodimension() const override;
50 int getSurfaceCodimension() const override;
51 int getLineCodimension() const override;
52 int getPointCodimension() const override;
53
54 void extractEnvelope(LineKernel &envelope) const;
55
56 virtual double evalCellArea(long) const;
57 virtual double evalEdgeLength(long, int) const;
58 virtual double evalMinEdgeLength(long, int &) const;
59 virtual double evalMaxEdgeLength(long, int &) const;
60 virtual double evalAngleAtVertex(long, int) const;
61 virtual double evalMinAngleAtVertex(long, int &) const;
62 virtual double evalMaxAngleAtVertex(long, int &) const;
63 virtual double evalAspectRatio(long, int &) const;
64 virtual std::array<double, 3> evalFacetNormal(long, const std::array<double, 3> &orientation = {{0., 0., 1.}}) const;
65 std::array<double, 3> evalEdgeNormal(long, int) const;
66 std::array<double, 3> evalVertexNormal(long, int) const;
67 std::array<double, 3> evalVertexNormal(long, int, std::size_t, const long *) const;
68 std::array<double, 3> evalLimitedVertexNormal(long, int, double ) const;
69 std::array<double, 3> evalLimitedVertexNormal(long, int, std::size_t, const long *, double ) const;
70 virtual void evalVertexNormals(long id, int vertex, std::size_t nVertexNeighs, const long *vertexNeighs, double limit,
71 std::array<double, 3> *unlimitedNormal, std::array<double, 3> *limitedNormal) const;
72 virtual void evalEdgeNormals(long id, int edge, double limit, std::array<double, 3> *unlimitedNormal,
73 std::array<double, 3> *limitedNormal) const;
74 double evalCellSize(long id) const override;
75 void evalBarycentricCoordinates(long id, const std::array<double, 3> &point, double *lambda) const;
76
77 bool isCellOrientationConsistent() const;
79 bool adjustCellOrientation(long id, bool invert = false);
80 void flipCellOrientation(long id);
81
83 bool areFacetVerticesOrdered(const Cell &facet) const;
84 int getFacetOrderedLocalVertex(const Cell &facet, std::size_t n) const;
85
87 bool areFacetEdgesOrdered(const Cell &facet) const;
88 int getFacetOrderedLocalEdge(const Cell &facet, std::size_t n) const;
89
90 void displayQualityStats(std::ostream&, unsigned int padding = 0) const;
91 std::vector<double> computeHistogram(eval_f_ funct_, std::vector<double> &bins, long &count, int n_intervals = 8, unsigned short mask = SELECT_ALL) const;
92
93private:
94 static const std::map<ElementType, unsigned short> m_selectionTypes;
95
96 void initialize();
97
98 bool compareSelectedTypes(unsigned short, ElementType) const;
99 void displayHistogram(long, const std::vector<double>&, const std::vector<double>&, const std::string&, std::ostream&, unsigned int padding = 0) const;
100
101 bool haveSameOrientation(const Cell &cell_A, int face_A, const Cell &cell_B, int face_B) const;
102
103protected:
104#if BITPIT_ENABLE_MPI==1
105 SurfaceKernel(MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode, PartitioningMode partitioningMode);
106 SurfaceKernel(int dimension, MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode, PartitioningMode partitioningMode);
107 SurfaceKernel(int id, int dimension, MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode, PartitioningMode partitioningMode);
108#else
109 SurfaceKernel(AdaptionMode adaptionMode);
110 SurfaceKernel(int dimension, AdaptionMode adaptionMode);
111 SurfaceKernel(int id, int dimension, AdaptionMode adaptionMode);
112#endif
113
114};
115
116}
117
118#endif
The Cell class defines the cells.
Definition cell.hpp:42
The PatchKernel class provides an interface for defining patches.
Metafunction for generating a list of elements that can be either stored in an external vectror or,...
The SurfaceKernel class provides an interface for defining surface patches.
int getVolumeCodimension() const override
int getPointCodimension() const override
int getFacetOrderedLocalEdge(const Cell &facet, std::size_t n) const
virtual void evalVertexNormals(long id, int vertex, std::size_t nVertexNeighs, const long *vertexNeighs, double limit, std::array< double, 3 > *unlimitedNormal, std::array< double, 3 > *limitedNormal) const
void displayQualityStats(std::ostream &, unsigned int padding=0) const
virtual double evalAspectRatio(long, int &) const
virtual double evalMinEdgeLength(long, int &) const
void flipCellOrientation(long id)
bool areFacetVerticesOrdered(const Cell &facet) const
int getLineCodimension() const override
std::vector< double > computeHistogram(eval_f_ funct_, std::vector< double > &bins, long &count, int n_intervals=8, unsigned short mask=SELECT_ALL) const
void extractEnvelope(LineKernel &envelope) const
ConstProxyVector< long > getFacetOrderedEdgeIds(const Cell &facet) const
int getSurfaceCodimension() const override
virtual double evalMaxAngleAtVertex(long, int &) const
virtual std::array< double, 3 > evalFacetNormal(long, const std::array< double, 3 > &orientation={{0., 0., 1.}}) const
int getFacetOrderedLocalVertex(const Cell &facet, std::size_t n) const
SurfaceKernel(MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode, PartitioningMode partitioningMode)
bool areFacetEdgesOrdered(const Cell &facet) const
bool isCellOrientationConsistent() const
std::array< double, 3 > evalEdgeNormal(long, int) const
ConstProxyVector< long > getFacetOrderedVertexIds(const Cell &facet) const
std::array< double, 3 > evalLimitedVertexNormal(long, int, double) const
virtual double evalCellArea(long) const
void evalBarycentricCoordinates(long id, const std::array< double, 3 > &point, double *lambda) const
virtual void evalEdgeNormals(long id, int edge, double limit, std::array< double, 3 > *unlimitedNormal, std::array< double, 3 > *limitedNormal) const
virtual double evalMaxEdgeLength(long, int &) const
virtual double evalMinAngleAtVertex(long, int &) const
double evalCellSize(long id) const override
std::array< double, 3 > evalVertexNormal(long, int) const
virtual double evalAngleAtVertex(long, int) const
virtual double evalEdgeLength(long, int) const
--- layout: doxygen_footer ---