NeoFOAM
WIP Prototype of a modern OpenFOAM core
Loading...
Searching...
No Matches
domainField.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: MIT
2// SPDX-FileCopyrightText: 2024 NeoFOAM authors
3#pragma once
4
5#include <Kokkos_Core.hpp>
6
7#include <iostream>
8
13
15
16namespace NeoFOAM
17{
18
30template<typename ValueType>
32{
33public:
34
36 : exec_(exec), internalField_(exec, 0), boundaryFields_(exec, 0, 0)
37 {}
38
39 DomainField(const Executor& exec, size_t nCells, size_t nBoundaryFaces, size_t nBoundaries)
40 : exec_(exec), internalField_(exec, nCells),
41 boundaryFields_(exec, nBoundaryFaces, nBoundaries)
42 {}
43
45 const Executor& exec,
47 const BoundaryFields<ValueType>& boundaryFields
48 )
49 : exec_(exec), internalField_(exec, internalField), boundaryFields_(exec, boundaryFields)
50 {}
51
53 const Executor& exec,
55 size_t nBoundaryFaces,
56 size_t nBoundaries
57 )
58 : exec_(exec), internalField_(exec, internalField),
59 boundaryFields_(exec, nBoundaryFaces, nBoundaries)
60 {}
61
63 : exec_(exec), internalField_(exec, mesh.nCells()),
64 boundaryFields_(exec, mesh.nBoundaryFaces(), mesh.nBoundaries())
65 {}
66
67
69 : exec_(rhs.exec_), internalField_(rhs.internalField_), boundaryFields_(rhs.boundaryFields_)
70 {}
71
72
74 : exec_(std::move(rhs.exec_)), internalField_(std::move(rhs.internalField_)),
75 boundaryFields_(std::move(rhs.boundaryFields_))
76 {}
77
78
80 {
81 internalField_ = rhs.internalField_;
82 boundaryFields_ = rhs.boundaryFields_;
83 return *this;
84 }
85
86
88 {
89 internalField_ = std::move(rhs.internalField_);
90 boundaryFields_ = std::move(rhs.boundaryFields_);
91 return *this;
92 }
93
94
95 const Field<ValueType>& internalField() const { return internalField_; }
96
97
98 Field<ValueType>& internalField() { return internalField_; }
99
100
101 const BoundaryFields<ValueType>& boundaryField() const { return boundaryFields_; }
102
103
104 BoundaryFields<ValueType>& boundaryField() { return boundaryFields_; }
105
106 const Executor& exec() const { return exec_; }
107
108private:
109
110 Executor exec_;
111 Field<ValueType> internalField_;
112 BoundaryFields<ValueType> boundaryFields_;
113};
114
115
116} // namespace NeoFOAM
Represents the boundary fields for a computational domain.
Represents the domain fields for a computational domain.
DomainField(const Executor &exec, const UnstructuredMesh &mesh)
const Executor & exec() const
DomainField(const Executor &exec, const Field< ValueType > &internalField, size_t nBoundaryFaces, size_t nBoundaries)
DomainField(const Executor &exec, const Field< ValueType > &internalField, const BoundaryFields< ValueType > &boundaryFields)
DomainField(const Executor &exec)
DomainField(const DomainField< ValueType > &rhs)
DomainField(DomainField< ValueType > &&rhs)
DomainField(const Executor &exec, size_t nCells, size_t nBoundaryFaces, size_t nBoundaries)
DomainField< ValueType > & operator=(const DomainField< ValueType > &rhs)
BoundaryFields< ValueType > & boundaryField()
const BoundaryFields< ValueType > & boundaryField() const
DomainField< ValueType > & operator=(DomainField< ValueType > &&rhs)
Field< ValueType > & internalField()
const Field< ValueType > & internalField() const
A class to contain the data and executors for a field and define some basic operations.
Definition field.hpp:49
Represents an unstructured mesh in NeoFOAM.
std::variant< SerialExecutor, CPUExecutor, GPUExecutor > Executor
Definition executor.hpp:16