ug4
cpu_algebra_types.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011-2015: G-CSC, Goethe University Frankfurt
3  * Author: Andreas Vogel
4  *
5  * This file is part of UG4.
6  *
7  * UG4 is free software: you can redistribute it and/or modify it under the
8  * terms of the GNU Lesser General Public License version 3 (as published by the
9  * Free Software Foundation) with the following additional attribution
10  * requirements (according to LGPL/GPL v3 §7):
11  *
12  * (1) The following notice must be displayed in the Appropriate Legal Notices
13  * of covered and combined works: "Based on UG4 (www.ug4.org/license)".
14  *
15  * (2) The following notice must be displayed at a prominent place in the
16  * terminal output of covered works: "Based on UG4 (www.ug4.org/license)".
17  *
18  * (3) The following bibliography is recommended for citation and must be
19  * preserved in all covered files:
20  * "Reiter, S., Vogel, A., Heppner, I., Rupp, M., and Wittum, G. A massively
21  * parallel geometric multigrid solver on hierarchically distributed grids.
22  * Computing and visualization in science 16, 4 (2013), 151-164"
23  * "Vogel, A., Reiter, S., Rupp, M., Nägel, A., and Wittum, G. UG4 -- a novel
24  * flexible software system for simulating pde based models on high performance
25  * computers. Computing and visualization in science 16, 4 (2013), 165-179"
26  *
27  * This program is distributed in the hope that it will be useful,
28  * but WITHOUT ANY WARRANTY; without even the implied warranty of
29  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30  * GNU Lesser General Public License for more details.
31  */
32 
33 #ifndef __H__UG__LIB_ALGEBRA__CPU_ALGEBRA_TYPES__
34 #define __H__UG__LIB_ALGEBRA__CPU_ALGEBRA_TYPES__
35 
36 #include "algebra_type.h"
37 
38 // vector and sparse_matrix
39 #include "cpu_algebra/vector.h"
41 
42 #ifdef UG_GPU
43 //#include "gpu_algebra/gpuvector.h"
44 //#include "gpu_algebra/gpusparsematrix.h"
45 #endif
46 
47 // parallel support
48 #ifdef UG_PARALLEL
51 #endif
52 
54 namespace ug{
55 
57 // CPU Algebra
59 
60 /* Define different algebra types.
61  * An Algebra should export the following typedef:
62  * - matrix_type
63  * - vector_type
64  */
65 
67 // CPU Algebra (Block 1x1 Algebra)
69 
76 struct CPUAlgebra
77 {
78 #ifdef UG_PARALLEL
81 #else
84 #endif
85 
86  static const int blockSize = 1;
88  {
89  return AlgebraType(AlgebraType::CPU, 1);
90  }
91 };
92 
93 // end group cpu_algebra
95 
101 /*#ifdef UG_GPU
102 struct GPUAlgebra
103 {
104 #ifdef UG_PARALLEL
105  typedef ParallelMatrix<GPUSparseMatrix<double> > matrix_type;
106  typedef ParallelVector<GPUVector<double> > vector_type;
107 #else
108  typedef GPUSparseMatrix<double> matrix_type;
109  typedef GPUVector<double> vector_type;
110 #endif
111 
112  static const int blockSize = 1;
113  static AlgebraType get_type()
114  {
115  return AlgebraType(AlgebraType::GPU, 1);
116  }
117 };
118 #endif
119 // end group crs_algebra
121 */
123 // CPU Fixed Block Algebra
126 template<int TBlockSize>
128 {
129 #ifdef UG_PARALLEL
132 #else
135 #endif
136 
137  static const int blockSize = TBlockSize;
139  {
140  return AlgebraType(AlgebraType::CPU, TBlockSize);
141  }
142 };
143 
145 // CPU Variable Block Algebra
147 
150 {
151 #ifdef UG_PARALLEL
154 #else
157 #endif
158 
161  {
163  }
164 };
165 
166 }
167 #endif /* __H__UG__LIB_ALGEBRA__CPU_ALGEBRA_TYPES__ */
class describing the type of an algebra
Definition: algebra_type.h:49
@ VariableBlockSize
Definition: algebra_type.h:59
@ CPU
Definition: algebra_type.h:54
Wrapper for sequential matrices to handle them in parallel.
Definition: parallel_matrix.h:65
Definition: parallel_vector.h:60
sparse matrix for big, variable sparse matrices.
Definition: sparsematrix.h:99
Definition: vector.h:55
ParallelVector< Vector< DenseVector< VariableArray1< double > > > > vector_type
Definition: cpu_algebra_types.h:153
static AlgebraType get_type()
Definition: cpu_algebra_types.h:160
static AlgebraType get_type()
Definition: cpu_algebra_types.h:138
ParallelMatrix< SparseMatrix< DenseMatrix< VariableArray2< double > > > > matrix_type
Definition: cpu_algebra_types.h:152
static const int blockSize
Definition: cpu_algebra_types.h:137
static AlgebraType get_type()
Definition: cpu_algebra_types.h:87
ParallelVector< Vector< DenseVector< FixedArray1< double, TBlockSize > > > > vector_type
Definition: cpu_algebra_types.h:131
static const int blockSize
Definition: cpu_algebra_types.h:86
ParallelMatrix< SparseMatrix< DenseMatrix< FixedArray2< double, TBlockSize, TBlockSize > > > > matrix_type
Definition: cpu_algebra_types.h:130
ParallelMatrix< SparseMatrix< double > > matrix_type
Definition: cpu_algebra_types.h:79
ParallelVector< Vector< double > > vector_type
Definition: cpu_algebra_types.h:80
static const int blockSize
Definition: cpu_algebra_types.h:159
the ug namespace
Definition: cpu_algebra_types.h:77
Definition: cpu_algebra_types.h:128
Definition: cpu_algebra_types.h:150