Loading...
Searching...
No Matches
levelSetCartesianKernel.cpp
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# include "bitpit_volcartesian.hpp"
26
27# include "levelSetKernel.hpp"
28# include "levelSetCartesianKernel.hpp"
29
30namespace bitpit {
31
45
46 BITPIT_UNUSED(fillIn);
47
48 // Get mesh information
49 const VolCartesian *mesh = getMesh();
50 int dimension = mesh->getDimension();
51 std::array<double, 3> spacing = mesh->getSpacing();
52
53 // Initialize bounding and tangent radii
54 m_cellTangentRadius = std::numeric_limits<double>::max();
55 m_cellBoundingRadius = 0.;
56 for(int i=0; i<dimension; ++i){
57 m_cellTangentRadius = std::min(m_cellTangentRadius, spacing[i]);
58 m_cellBoundingRadius += spacing[i] * spacing[i];
59 }
60 m_cellTangentRadius = 0.5 * m_cellTangentRadius;
61 m_cellBoundingRadius = 0.5 * std::sqrt(m_cellBoundingRadius);
62
63}
64
70
71 return static_cast<VolCartesian *>(LevelSetKernel::getMesh()) ;
72
73}
74
84
85 return m_cellTangentRadius;
86
87}
88
98
99 return m_cellBoundingRadius;
100
101}
102
109std::array<double, 3> LevelSetCartesianKernel::computeCellCentroid( long id ) const {
110
111 const VolCartesian *mesh = getMesh();
112
113 return mesh->evalCellCentroid( id );
114}
115
126
127 BITPIT_UNUSED( id );
128
129 return getCellTangentRadius();
130
131}
132
143
144 BITPIT_UNUSED( id );
145
146 return getCellBoundingRadius();
147
148}
149
150}
Base class for defining kernels that need to cache data.
VolCartesian * getMesh() const override
LevelSetCartesianKernel(VolCartesian &patch, LevelSetFillIn fillIn)
double computeCellTangentRadius(long) const override
std::array< double, 3 > computeCellCentroid(long) const override
double computeCellBoundingRadius(long) const override
virtual VolumeKernel * getMesh() const
The VolCartesian defines a Cartesian patch.
std::array< double, 3 > evalCellCentroid(long id) const override
std::array< double, 3 > getSpacing() const
#define BITPIT_UNUSED(variable)
Definition compiler.hpp:63
--- layout: doxygen_footer ---