NeoN
A framework for CFD software
Loading...
Searching...
No Matches
surfaceBoundaryFactory.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2023 - 2025 NeoN authors
2//
3// SPDX-License-Identifier: MIT
4
5#pragma once
6
10#include "NeoN/fields/field.hpp"
13
15{
16
17template<typename ValueType>
20 SurfaceBoundaryFactory<ValueType>,
21 Parameters<const UnstructuredMesh&, const Dictionary&, localIdx>>,
23{
24public:
25
26 static std::string name() { return "SurfaceBoundaryFactory"; }
27
29 const UnstructuredMesh& mesh, [[maybe_unused]] const Dictionary&, localIdx patchID
30 )
31 : BoundaryPatchMixin(mesh, patchID) {};
32
34
35 virtual std::unique_ptr<SurfaceBoundaryFactory> clone() const = 0;
36};
37
38
44template<typename ValueType>
46{
47public:
48
51 mesh.boundaryMesh().offset()[static_cast<size_t>(patchID)],
52 mesh.boundaryMesh().offset()[static_cast<size_t>(patchID) + 1],
54 ),
55 boundaryCorrectionStrategy_(SurfaceBoundaryFactory<ValueType>::create(
56 dict.get<std::string>("type"), mesh, dict, patchID
57 ))
58 {}
59
61 : BoundaryPatchMixin(other),
62 boundaryCorrectionStrategy_(other.boundaryCorrectionStrategy_->clone())
63 {}
64
65 virtual void correctBoundaryCondition(Field<ValueType>& domainVector)
66 {
67 boundaryCorrectionStrategy_->correctBoundaryCondition(domainVector);
68 }
69
70
71private:
72
73 // NOTE needs full namespace to be not ambiguous
74 std::unique_ptr<NeoN::finiteVolume::cellCentred::SurfaceBoundaryFactory<ValueType>>
75 boundaryCorrectionStrategy_;
76};
77
78
79}
A class representing a dictionary that stores key-value pairs.
Represents the domain fields for a computational domain.
Definition field.hpp:36
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< SurfaceBoundaryFactory > clone() const =0
virtual void correctBoundaryCondition(Field< ValueType > &field)=0
SurfaceBoundaryFactory(const UnstructuredMesh &mesh, const Dictionary &, localIdx patchID)
Represents a surface boundary field for a cell-centered finite volume method.
virtual void correctBoundaryCondition(Field< ValueType > &domainVector)
SurfaceBoundary(const UnstructuredMesh &mesh, const Dictionary &dict, localIdx patchID)
int32_t localIdx
Definition label.hpp:32
std::size_t size_t
Definition label.hpp:38