NeoN
WIP Prototype of a modern OpenFOAM core
Loading...
Searching...
No Matches
volumeBoundaryFactory.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: MIT
2// SPDX-FileCopyrightText: 2023 NeoN authors
3
4#pragma once
5
12
14{
15
16template<typename ValueType>
19 VolumeBoundaryFactory<ValueType>,
20 Parameters<const UnstructuredMesh&, const Dictionary&, localIdx>>,
22{
23public:
24
25 static std::string name() { return "VolumeBoundaryFactory"; }
26
28 const UnstructuredMesh& mesh, [[maybe_unused]] const Dictionary&, localIdx patchID
29 )
30 : BoundaryPatchMixin(mesh, patchID) {};
31
32 virtual ~VolumeBoundaryFactory() = default;
33
34 virtual void correctBoundaryCondition(Field<ValueType>& domainVector) = 0;
35
36 virtual std::unique_ptr<VolumeBoundaryFactory> clone() const = 0;
37};
38
39
45template<typename ValueType>
47{
48public:
49
52 mesh.boundaryMesh().offset()[static_cast<size_t>(patchID)],
53 mesh.boundaryMesh().offset()[static_cast<size_t>(patchID) + 1],
55 ),
56 boundaryCorrectionStrategy_(VolumeBoundaryFactory<ValueType>::create(
57 dict.get<std::string>("type"), mesh, dict, patchID
58 ))
59 {}
60
62 : BoundaryPatchMixin(other),
63 boundaryCorrectionStrategy_(other.boundaryCorrectionStrategy_->clone())
64 {}
65
66 virtual void correctBoundaryCondition(Field<ValueType>& domainVector)
67 {
68 boundaryCorrectionStrategy_->correctBoundaryCondition(domainVector);
69 }
70
71private:
72
73 // NOTE needs full namespace to be not ambiguous
74 std::unique_ptr<NeoN::finiteVolume::cellCentred::VolumeBoundaryFactory<ValueType>>
75 boundaryCorrectionStrategy_;
76};
77
78}
A class representing a dictionary that stores key-value pairs.
Represents the domain fields for a computational domain.
Definition field.hpp:34
A factory class for runtime selection of derived classes.
Represents an unstructured mesh in NeoN.
A base class for implementing derived boundary conditions.
virtual std::unique_ptr< VolumeBoundaryFactory > clone() const =0
virtual void correctBoundaryCondition(Field< ValueType > &domainVector)=0
VolumeBoundaryFactory(const UnstructuredMesh &mesh, const Dictionary &, localIdx patchID)
Represents a volume boundary field for a cell-centered finite volume method.
VolumeBoundary(const UnstructuredMesh &mesh, const Dictionary &dict, localIdx patchID)
virtual void correctBoundaryCondition(Field< ValueType > &domainVector)
int32_t localIdx
Definition label.hpp:30
std::size_t size_t
Definition label.hpp:36