Loading...
Searching...
No Matches
levelSetKernel.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_LEVELSET_KERNEL_HPP__
26# define __BITPIT_LEVELSET_KERNEL_HPP__
27
28// Standard Template Library
29# include <array>
30# include <memory>
31# include <vector>
32# include <unordered_map>
33
34# if BITPIT_ENABLE_MPI
35# include <mpi.h>
36# include "bitpit_communications.hpp"
37# endif
38# include "bitpit_common.hpp"
39# include "bitpit_patchkernel.hpp"
40
41# include "levelSetCache.hpp"
42
43namespace bitpit{
44
45class VolumeKernel ;
46
48
49 private:
50# if BITPIT_ENABLE_MPI
51 void initializeCommunicator();
52 void freeCommunicator();
53# endif
54
55
56 protected:
59# if BITPIT_ENABLE_MPI
60 MPI_Comm m_communicator;
61# endif
62
63 public:
64 virtual ~LevelSetKernel() ;
67
68 virtual VolumeKernel * getMesh() const;
69
71
72 double getDistanceTolerance() const;
73
74 virtual std::array<double, 3> computeCellCentroid(long) const = 0;
75 virtual double computeCellTangentRadius(long) const = 0;
76 virtual double computeCellBoundingRadius(long) const = 0;
77
78 virtual bool update(const std::vector<adaption::Info> &);
79
80 virtual bool intersectCellPlane(long, const std::array<double,3> &, const std::array<double,3> &, double);
81
82 BITPIT_DEPRECATED(bool isPointInCell(long, const std::array<double,3> &) const);
83 BITPIT_DEPRECATED(double isCellInsideBoundingBox(long, const std::array<double BITPIT_COMMA 3> &, const std::array<double,3> & ) const);
84
85# if BITPIT_ENABLE_MPI
86 MPI_Comm getCommunicator() const;
87 bool isCommunicatorSet() const;
88
89 std::unique_ptr<DataCommunicator> createDataCommunicator() const;
90# endif
91
92};
93
95
96 public:
98
100
101 void clearCaches(bool release = false);
102
103 bool update(const std::vector<adaption::Info> &) override;
104
105 protected:
106 mutable std::unique_ptr<CellCacheCollection> m_cellCacheCollection;
110
111};
112
113}
114
115#endif
The class ElementCacheCollection allows to store a collection of caches for the elements of a mesh.
Base class for defining kernels that need to cache data.
LevelSetCachedKernel(VolumeKernel *, LevelSetFillIn fillIn)
bool update(const std::vector< adaption::Info > &) override
CellCacheCollection & getCellCacheCollection()
void clearCaches(bool release=false)
std::unique_ptr< CellCacheCollection > m_cellCacheCollection
Mesh specific implementation to calculate the levelset function.
virtual VolumeKernel * getMesh() const
LevelSetFillIn getExpectedFillIn() const
virtual bool update(const std::vector< adaption::Info > &)
double getDistanceTolerance() const
double isCellInsideBoundingBox(long, const std::array< double BITPIT_COMMA 3 > &, const std::array< double, 3 > &) const
virtual bool intersectCellPlane(long, const std::array< double, 3 > &, const std::array< double, 3 > &, double)
MPI_Comm getCommunicator() const
bool isPointInCell(long, const std::array< double, 3 > &) const
std::unique_ptr< DataCommunicator > createDataCommunicator() const
LevelSetFillIn m_expectedFillIn
The VolumeKernel class provides an interface for defining volume patches.
#define BITPIT_DEPRECATED(func)
Definition compiler.hpp:87
--- layout: doxygen_footer ---