NeoN
WIP Prototype of a modern OpenFOAM core
Loading...
Searching...
No Matches
sparsityPattern.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: MIT
2// SPDX-FileCopyrightText: 2025 NeoN authors
3
4#pragma once
5
7// #include "NeoN/linearAlgebra/linearSystem.hpp"
8
10{
11
12/* @class SparsityPattern
13 * @brief row and column index representation of a mesh
14 *
15 * This class implements the finite volume 3/5/7 pt stencil specific generation
16 * of sparsity patterns from a given unstructured mesh
17 *
18 */
20{
21public:
22
23 // TODO implement ctor copying all members
25
26 void update();
27
28 // TODO: rename upperOffset
30
31 // TODO: rename lowerOffset
33
35
36 const UnstructuredMesh& mesh() const { return mesh_; };
37
38 [[nodiscard]] const Vector<localIdx>& colIdxs() const { return colIdxs_; };
39
40 [[nodiscard]] const Vector<localIdx>& rowPtrs() const { return rowPtrs_; };
41
42 [[nodiscard]] localIdx rows() const { return diagOffset_.size(); };
43
44 [[nodiscard]] localIdx nnz() const { return colIdxs_.size(); };
45
46 // add selection mechanism via dictionary later
47 static const std::shared_ptr<SparsityPattern> readOrCreate(const UnstructuredMesh& mesh);
48
49private:
50
51 const UnstructuredMesh& mesh_;
52
53 Vector<localIdx> rowPtrs_;
54
55 Vector<localIdx> colIdxs_;
56
57 Vector<uint8_t> ownerOffset_;
58
59 Vector<uint8_t> neighbourOffset_;
60
61 Vector<uint8_t> diagOffset_;
62};
63
64} // namespace NeoN::finiteVolume::cellCentred
Represents an unstructured mesh in NeoN.
A class to contain the data and executors for a field and define some basic operations.
Definition vector.hpp:53
localIdx size() const
Gets the size of the field.
Definition vector.hpp:364
const Vector< localIdx > & rowPtrs() const
static const std::shared_ptr< SparsityPattern > readOrCreate(const UnstructuredMesh &mesh)
const Vector< uint8_t > & neighbourOffset() const
const Vector< uint8_t > & ownerOffset() const
SparsityPattern(const UnstructuredMesh &mesh)
const Vector< uint8_t > & diagOffset() const
const Vector< localIdx > & colIdxs() const
int32_t localIdx
Definition label.hpp:30