MyraMath
laplacian3.h
Go to the documentation of this file.
1 // ========================================================================= //
2 // This file is part of MyraMath, copyright (c) 2014-2019 by Ryan A Chilton //
3 // and distributed by MyraCore, LLC. See LICENSE.txt for license terms. //
4 // ========================================================================= //
5 
6 #ifndef MYRAMATH_SPARSE_LAPLACIAN3_H
7 #define MYRAMATH_SPARSE_LAPLACIAN3_H
8 
14 #include <myramath/MYRAMATH_EXPORT.h>
16 
17 #include <utility>
18 #include <vector>
19 
20 namespace myra {
21 
22 // Forward declarations.
23 class Pattern;
24 class Permutation;
25 template<class Number> class SparseMatrix;
26 
28 class MYRAMATH_EXPORT Natural3D
29  {
30 
31  public:
32 
34  Natural3D(int in_I, int in_J, int in_K);
35 
37  std::vector<int> size() const;
38 
40  int operator () (int i, int j, int k) const;
41 
43  std::pair<Natural3D, Natural3D> i_split() const;
44 
46  std::pair<Natural3D, Natural3D> j_split() const;
47 
49  std::pair<Natural3D, Natural3D> k_split() const;
50 
51  private:
52 
53  // Full constructor used by splitting methods.
54  Natural3D(int in_I, int in_i_begin, int in_i_end, int in_J, int in_j_begin, int in_j_end, int in_K, int in_k_begin, int in_k_end);
55 
56  // Private data - total size (I/J/K) and begin/end specification of subwindow.
57  int I, i_begin, i_end;
58  int J, j_begin, j_end;
59  int K, k_begin, k_end;
60  };
61 
63 MYRAMATH_EXPORT Pattern stencil3(int I, int J, int K);
64 
66 template<class Number> SparseMatrix<Number> laplacian3(int I, int J, int K);
67 template<> MYRAMATH_EXPORT SparseMatrix<NumberS> laplacian3<NumberS>(int I, int J, int K);
68 template<> MYRAMATH_EXPORT SparseMatrix<NumberD> laplacian3<NumberD>(int I, int J, int K);
69 template<> MYRAMATH_EXPORT SparseMatrix<NumberC> laplacian3<NumberC>(int I, int J, int K);
70 template<> MYRAMATH_EXPORT SparseMatrix<NumberZ> laplacian3<NumberZ>(int I, int J, int K);
71 
73 MYRAMATH_EXPORT Permutation bisect3(int I, int J, int K);
74 
76 MYRAMATH_EXPORT Pattern stencil3_unsymmetric(int I, int J, int K, double density = 0.5);
77 
78 } // namespace
79 
80 #endif
Represents a Permutation matrix, used to reorder rows/columns/etc of various numeric containers...
Definition: Permutation.h:34
A helper class that generates a natural ordering on a 3D structured grid of size IxJxK.
Definition: laplacian3.h:28
Definition: syntax.dox:1
Various utility functions/classes related to scalar Number types.
Holds the nonzero pattern of a sparse matrix.
Definition: Pattern.h:55
Stores an IxJ matrix A in compressed sparse column format.
Definition: bothcat.h:23