NeoN
A framework for CFD software
Loading...
Searching...
No Matches
domain.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2024 - 2026 NeoN authors
2//
3// SPDX-License-Identifier: MIT
4
5#pragma once
6
13
15{
16
27template<typename ValueType>
29{
30public:
31
32
33 typedef ValueType ElementType;
34
45 const Executor& exec,
46 std::string fieldName,
49 )
50 : name(std::move(fieldName)), exec_(exec), mesh_(mesh), field_(std::move(field))
51 {}
52
63 const Executor& exec,
64 std::string fieldName,
67 const BoundaryData<ValueType>& boundaryVectors
68 )
69 : name(fieldName), exec_(exec), mesh_(mesh), field_({exec, internalVector, boundaryVectors})
70 {
71 if (mesh.nCells() != internalVector.size())
72 {
73 NF_ERROR_EXIT("Inconsistent size of mesh and internal field detected");
74 }
75 }
76
82 const Vector<ValueType>& internalVector() const { return field_.internalVector(); }
83
89 Vector<ValueType>& internalVector() { return field_.internalVector(); }
90
96 sizeType size() const { return field_.internalVector().size(); }
97
103 const BoundaryData<ValueType>& boundaryData() const { return field_.boundaryData(); }
104
110 BoundaryData<ValueType>& boundaryData() { return field_.boundaryData(); }
111
117 const Executor& exec() const { return exec_; }
118
124 const UnstructuredMesh& mesh() const { return mesh_; }
125
126 std::string name; // The name of the field
127
128protected:
129
130 Executor exec_; // The executor object
131 const UnstructuredMesh& mesh_; // The unstructured mesh object
132 Field<ValueType> field_; // The domain field object
133};
134
135} // namespace NeoN
Represents the boundary fields for a computational domain.
Represents the domain fields for a computational domain.
Definition field.hpp:34
Represents an unstructured mesh in NeoN.
sizeType nCells() const
Get the number of cells in the mesh.
An executor-aware contiguous container for numerical data with vector-style arithmetic semantics.
Definition vector.hpp:40
sizeType size() const
Returns the size of the internal field.
Definition domain.hpp:96
DomainMixin(const Executor &exec, std::string fieldName, const UnstructuredMesh &mesh, const Vector< ValueType > &internalVector, const BoundaryData< ValueType > &boundaryVectors)
Constructor for DomainMixin.
Definition domain.hpp:62
BoundaryData< ValueType > & boundaryData()
Returns a reference to the boundary field.
Definition domain.hpp:110
DomainMixin(const Executor &exec, std::string fieldName, const UnstructuredMesh &mesh, Field< ValueType > field)
Constructor for DomainMixin.
Definition domain.hpp:44
const UnstructuredMesh & mesh() const
Returns a const reference to the unstructured mesh object.
Definition domain.hpp:124
const BoundaryData< ValueType > & boundaryData() const
Returns a const reference to the boundary field.
Definition domain.hpp:103
Vector< ValueType > & internalVector()
Returns a reference to the internal field.
Definition domain.hpp:89
const Executor & exec() const
Returns a const reference to the executor object.
Definition domain.hpp:117
const Vector< ValueType > & internalVector() const
Returns a const reference to the internal field.
Definition domain.hpp:82
#define NF_ERROR_EXIT(message)
Macro for printing an error message and aborting the program.
Definition error.hpp:90
std::variant< SerialExecutor, CPUExecutor, GPUExecutor > Executor
Definition executor.hpp:21
std::size_t sizeType
Definition label.hpp:56