|
28 | 28 |
|
29 | 29 | #pragma once |
30 | 30 |
|
31 | | -#include "../../include/parallelization/mpi_structure.hpp" |
32 | | -#include "../../include/parallelization/omp_structure.hpp" |
33 | | -#include "../../include/parallelization/vectorization.hpp" |
| 31 | +#include "../../include/CConfig.hpp" |
34 | 32 | #include "CSysVector.hpp" |
35 | 33 | #include "CPastixWrapper.hpp" |
36 | 34 |
|
@@ -75,16 +73,43 @@ struct mkl_jit_wrapper<float> { |
75 | 73 | #endif |
76 | 74 | #endif |
77 | 75 |
|
78 | | -class CConfig; |
79 | 76 | class CGeometry; |
80 | 77 |
|
| 78 | +struct CSysMatrixComms { |
| 79 | + /*! |
| 80 | + * \brief Routine to load a vector quantity into the data structures for MPI point-to-point |
| 81 | + * communication and to launch non-blocking sends and recvs. |
| 82 | + * \param[in] x - CSysVector holding the array of data. |
| 83 | + * \param[in] geometry - Geometrical definition of the problem. |
| 84 | + * \param[in] config - Definition of the particular problem. |
| 85 | + * \param[in] commType - Enumerated type for the quantity to be communicated. |
| 86 | + */ |
| 87 | + template<class T> |
| 88 | + static void Initiate(const CSysVector<T>& x, CGeometry *geometry, const CConfig *config, |
| 89 | + unsigned short commType = SOLUTION_MATRIX); |
| 90 | + |
| 91 | + /*! |
| 92 | + * \brief Routine to complete the set of non-blocking communications launched by |
| 93 | + * Initiate() and unpacking of the data in the vector. |
| 94 | + * \param[in] x - CSysVector holding the array of data. |
| 95 | + * \param[in] geometry - Geometrical definition of the problem. |
| 96 | + * \param[in] config - Definition of the particular problem. |
| 97 | + * \param[in] commType - Enumerated type for the quantity to be unpacked. |
| 98 | + */ |
| 99 | + template<class T> |
| 100 | + static void Complete(CSysVector<T>& x, CGeometry *geometry, const CConfig *config, |
| 101 | + unsigned short commType = SOLUTION_MATRIX); |
| 102 | +}; |
| 103 | + |
81 | 104 | /*! |
82 | 105 | * \class CSysMatrix |
83 | 106 | * \brief Main class for defining block-compressed-row-storage sparse matrices. |
84 | 107 | */ |
85 | 108 | template<class ScalarType> |
86 | 109 | class CSysMatrix { |
87 | 110 | private: |
| 111 | + friend class CSysMatrixComms; |
| 112 | + |
88 | 113 | const int rank; /*!< \brief MPI Rank. */ |
89 | 114 | const int size; /*!< \brief MPI Size. */ |
90 | 115 |
|
@@ -163,9 +188,11 @@ class CSysMatrix { |
163 | 188 |
|
164 | 189 | /*! |
165 | 190 | * \brief Handle type conversion for when we Set, Add, etc. blocks, preserving derivative information (if supported by types). |
166 | | - * \note See specialization for discrete adjoint right outside this class's declaration. |
167 | 191 | */ |
168 | | - template<class DstType, class SrcType> |
| 192 | + template<class DstType, class SrcType, su2enable_if<std::is_arithmetic<DstType>::value> = 0> |
| 193 | + FORCEINLINE static DstType ActiveAssign(const SrcType& val) { return SU2_TYPE::GetValue(val); } |
| 194 | + |
| 195 | + template<class DstType, class SrcType, su2enable_if<!std::is_arithmetic<DstType>::value> = 0> |
169 | 196 | FORCEINLINE static DstType ActiveAssign(const SrcType& val) { return val; } |
170 | 197 |
|
171 | 198 | /*! |
@@ -378,34 +405,6 @@ class CSysMatrix { |
378 | 405 | */ |
379 | 406 | void SetValDiagonalZero(void); |
380 | 407 |
|
381 | | - /*! |
382 | | - * \brief Routine to load a vector quantity into the data structures for MPI point-to-point |
383 | | - * communication and to launch non-blocking sends and recvs. |
384 | | - * \param[in] x - CSysVector holding the array of data. |
385 | | - * \param[in] geometry - Geometrical definition of the problem. |
386 | | - * \param[in] config - Definition of the particular problem. |
387 | | - * \param[in] commType - Enumerated type for the quantity to be communicated. |
388 | | - */ |
389 | | - template<class OtherType> |
390 | | - void InitiateComms(const CSysVector<OtherType> & x, |
391 | | - CGeometry *geometry, |
392 | | - const CConfig *config, |
393 | | - unsigned short commType) const; |
394 | | - |
395 | | - /*! |
396 | | - * \brief Routine to complete the set of non-blocking communications launched by |
397 | | - * InitiateComms() and unpacking of the data in the vector. |
398 | | - * \param[in] x - CSysVector holding the array of data. |
399 | | - * \param[in] geometry - Geometrical definition of the problem. |
400 | | - * \param[in] config - Definition of the particular problem. |
401 | | - * \param[in] commType - Enumerated type for the quantity to be unpacked. |
402 | | - */ |
403 | | - template<class OtherType> |
404 | | - void CompleteComms(CSysVector<OtherType> & x, |
405 | | - CGeometry *geometry, |
406 | | - const CConfig *config, |
407 | | - unsigned short commType) const; |
408 | | - |
409 | 408 | /*! |
410 | 409 | * \brief Get a pointer to the start of block "ij" |
411 | 410 | * \param[in] block_i - Row index. |
@@ -918,8 +917,3 @@ class CSysMatrix { |
918 | 917 | CGeometry *geometry, const CConfig *config) const; |
919 | 918 |
|
920 | 919 | }; |
921 | | - |
922 | | -#ifdef CODI_REVERSE_TYPE |
923 | | -template<> template<> |
924 | | -FORCEINLINE su2mixedfloat CSysMatrix<su2mixedfloat>::ActiveAssign(const su2double& val) { return SU2_TYPE::GetValue(val); } |
925 | | -#endif |
0 commit comments