Nektar++
Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
Nektar::LibUtilities::Transposition Class Reference

#include <Transposition.h>

Collaboration diagram for Nektar::LibUtilities::Transposition:
Collaboration graph
[legend]

Public Member Functions

 Transposition (const LibUtilities::BasisKey &HomoBasis0, LibUtilities::CommSharedPtr hcomm)
 
 Transposition (const LibUtilities::BasisKey &HomoBasis0, const LibUtilities::BasisKey &HomoBasis1, LibUtilities::CommSharedPtr hcomm)
 
 Transposition (const LibUtilities::BasisKey &HomoBasis0, const LibUtilities::BasisKey &HomoBasis1, const LibUtilities::BasisKey &HomoBasis2, LibUtilities::CommSharedPtr hcomm)
 
 ~Transposition ()
 
unsigned int GetK (int i)
 
Array< OneD, unsigned int > GetKs (void)
 
unsigned int GetPlaneID (int i)
 
Array< OneD, unsigned int > GetPlanesIDs (void)
 
void Transpose (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, bool UseNumMode=false, TranspositionDir dir=eNoTrans)
 
void SetSpecVanVisc (Array< OneD, NekDouble > visc)
 
NekDouble GetSpecVanVisc (const int k)
 

Protected Attributes

CommSharedPtr m_hcomm
 

Private Member Functions

void TransposeXYtoZ (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, bool UseNumMode=false)
 
void TransposeZtoXY (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, bool UseNumMode=false)
 
void TransposeXtoYZ (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, bool UseNumMode=false)
 
void TransposeYZtoX (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, bool UseNumMode=false)
 
void TransposeYZtoZY (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, bool UseNumMode=false)
 
void TransposeZYtoYZ (const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, bool UseNumMode=false)
 

Private Attributes

int m_num_homogeneous_directions
 
Array< OneD, int > m_num_points_per_proc
 Number of homogeneous points on each processor per direction. More...
 
Array< OneD, int > m_num_homogeneous_points
 Total homogeneous points per direction. More...
 
Array< OneD, int > m_num_homogeneous_coeffs
 Total number of homogeneous coefficients. More...
 
Array< OneD, int > m_num_processes
 
int m_rank_id
 Rank of process. More...
 
Array< OneD, unsigned int > m_planes_IDs
 IDs of the planes on the processes. More...
 
Array< OneD, unsigned int > m_K
 Fourier wave numbers associated with the planes. More...
 
Array< OneD, int > m_SizeMap
 MPI_Alltoallv map containing size of send/recv buffer. More...
 
Array< OneD, int > m_OffsetMap
 MPI_Alltoallv offset map of send/recv buffer in global vector. More...
 

Detailed Description

Definition at line 63 of file Transposition.h.

Constructor & Destructor Documentation

Nektar::LibUtilities::Transposition::Transposition ( const LibUtilities::BasisKey HomoBasis0,
LibUtilities::CommSharedPtr  hcomm 
)

Constructor for 1D transform.

Definition at line 52 of file Transposition.cpp.

References Nektar::LibUtilities::eFourier, Nektar::LibUtilities::eFourierHalfModeIm, Nektar::LibUtilities::eFourierHalfModeRe, Nektar::LibUtilities::eFourierSingleMode, Nektar::LibUtilities::BasisKey::GetBasisType(), Nektar::LibUtilities::BasisKey::GetNumModes(), Nektar::LibUtilities::BasisKey::GetNumPoints(), m_hcomm, m_K, m_num_homogeneous_coeffs, m_num_homogeneous_directions, m_num_homogeneous_points, m_num_points_per_proc, m_num_processes, m_planes_IDs, and m_rank_id.

54  {
55  m_hcomm = hcomm;
57 
59  Array<OneD,int>(m_num_homogeneous_directions);
61  Array<OneD,int>(m_num_homogeneous_directions);
63  Array<OneD,int>(m_num_homogeneous_directions);
65  Array<OneD,int>(m_num_homogeneous_directions);
66 
67  m_num_homogeneous_points[0] = HomoBasis0.GetNumPoints();
68  m_num_homogeneous_coeffs[0] = HomoBasis0.GetNumModes();
69  m_num_processes[0] = m_hcomm->GetSize();
70  m_num_points_per_proc[0] = m_num_homogeneous_points[0] /
71  m_num_processes[0];
72  m_rank_id = m_hcomm->GetRank();
73 
74  //================================================================
75  // TODO: Need to be generalised for 1D, 2D and 3D
76  m_planes_IDs = Array<OneD, unsigned int>(m_num_points_per_proc[0]);
77  m_K = Array<OneD, unsigned int>(m_num_points_per_proc[0]);
78 
79  for(int i = 0 ; i < m_num_points_per_proc[0] ; i++)
80  {
81  m_planes_IDs[i] = m_rank_id*m_num_points_per_proc[0] + i;
82  }
83 
84  if(HomoBasis0.GetBasisType() == LibUtilities::eFourier)
85  {
86  for(int i = 0 ; i < m_num_points_per_proc[0] ; i++)
87  {
88  m_K[i] = m_planes_IDs[i]/2;
89  }
90  }
91 
92  if(HomoBasis0.GetBasisType() == LibUtilities::eFourierSingleMode)
93  {
94  m_K[0] = 1;
95  m_K[1] = 1;
96  }
97 
98  if(HomoBasis0.GetBasisType() == LibUtilities::eFourierHalfModeRe ||
99  HomoBasis0.GetBasisType() == LibUtilities::eFourierHalfModeIm)
100  {
101  m_K[0]=1;
102  }
103  //================================================================
104  }
Array< OneD, int > m_num_homogeneous_points
Total homogeneous points per direction.
Fourier Expansion .
Definition: BasisType.h:52
Array< OneD, unsigned int > m_planes_IDs
IDs of the planes on the processes.
Fourier Modified expansions with just the real part of the first mode .
Definition: BasisType.h:59
Fourier Modified expansions with just the imaginary part of the first mode .
Definition: BasisType.h:60
Array< OneD, unsigned int > m_K
Fourier wave numbers associated with the planes.
Array< OneD, int > m_num_homogeneous_coeffs
Total number of homogeneous coefficients.
Fourier ModifiedExpansion with just the first mode .
Definition: BasisType.h:58
Array< OneD, int > m_num_points_per_proc
Number of homogeneous points on each processor per direction.
Nektar::LibUtilities::Transposition::Transposition ( const LibUtilities::BasisKey HomoBasis0,
const LibUtilities::BasisKey HomoBasis1,
LibUtilities::CommSharedPtr  hcomm 
)

Constructor for 2D transform.

Definition at line 110 of file Transposition.cpp.

References Nektar::LibUtilities::BasisKey::GetNumModes(), Nektar::LibUtilities::BasisKey::GetNumPoints(), m_hcomm, m_num_homogeneous_coeffs, m_num_homogeneous_directions, m_num_homogeneous_points, m_num_points_per_proc, and m_num_processes.

113  {
114  m_hcomm = hcomm;
116 
118  Array<OneD,int>(m_num_homogeneous_directions);
120  Array<OneD,int>(m_num_homogeneous_directions);
122  Array<OneD,int>(m_num_homogeneous_directions);
124  Array<OneD,int>(m_num_homogeneous_directions);
125 
126  m_num_homogeneous_points[0] = HomoBasis0.GetNumPoints();
127  m_num_homogeneous_coeffs[0] = HomoBasis0.GetNumModes();
128  m_num_homogeneous_points[1] = HomoBasis1.GetNumPoints();
129  m_num_homogeneous_coeffs[1] = HomoBasis1.GetNumModes();
130 
131  m_num_processes[0] = m_hcomm->GetRowComm()->GetSize();
132  m_num_processes[1] = m_hcomm->GetColumnComm()->GetSize();
133 
134  m_num_points_per_proc[0] = m_num_homogeneous_points[0] /
135  m_num_processes[0];
136  m_num_points_per_proc[1] = m_num_homogeneous_points[1] /
137  m_num_processes[1];
138 
139  //================================================================
140  // TODO: Need set up for 2D lines IDs and Ks if Fourier
141  //================================================================
142  }
Array< OneD, int > m_num_homogeneous_points
Total homogeneous points per direction.
Array< OneD, int > m_num_homogeneous_coeffs
Total number of homogeneous coefficients.
Array< OneD, int > m_num_points_per_proc
Number of homogeneous points on each processor per direction.
Nektar::LibUtilities::Transposition::Transposition ( const LibUtilities::BasisKey HomoBasis0,
const LibUtilities::BasisKey HomoBasis1,
const LibUtilities::BasisKey HomoBasis2,
LibUtilities::CommSharedPtr  hcomm 
)

Constructor for 3D transform.

Definition at line 148 of file Transposition.cpp.

References ASSERTL0, m_hcomm, m_num_homogeneous_coeffs, m_num_homogeneous_directions, m_num_homogeneous_points, m_num_points_per_proc, and m_num_processes.

152  {
153  m_hcomm = hcomm;
155 
157  Array<OneD,int>(m_num_homogeneous_directions);
159  Array<OneD,int>(m_num_homogeneous_directions);
161  Array<OneD,int>(m_num_homogeneous_directions);
163  Array<OneD,int>(m_num_homogeneous_directions);
164 
165  //================================================================
166  // TODO: Need set up for 3D
167  ASSERTL0(false, "Transposition is not set up for 3D.");
168  //================================================================
169  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:161
Array< OneD, int > m_num_homogeneous_points
Total homogeneous points per direction.
Array< OneD, int > m_num_homogeneous_coeffs
Total number of homogeneous coefficients.
Array< OneD, int > m_num_points_per_proc
Number of homogeneous points on each processor per direction.
Nektar::LibUtilities::Transposition::~Transposition ( )

Destructor

Definition at line 175 of file Transposition.cpp.

176  {
177 
178  }

Member Function Documentation

unsigned int Nektar::LibUtilities::Transposition::GetK ( int  i)

Definition at line 182 of file Transposition.cpp.

References m_K.

183  {
184  return m_K[i];
185  }
Array< OneD, unsigned int > m_K
Fourier wave numbers associated with the planes.
Array< OneD, unsigned int > Nektar::LibUtilities::Transposition::GetKs ( void  )

Definition at line 187 of file Transposition.cpp.

References m_K.

188  {
189  return m_K;
190  }
Array< OneD, unsigned int > m_K
Fourier wave numbers associated with the planes.
unsigned int Nektar::LibUtilities::Transposition::GetPlaneID ( int  i)

Definition at line 192 of file Transposition.cpp.

References m_planes_IDs.

193  {
194  return m_planes_IDs[i];
195  }
Array< OneD, unsigned int > m_planes_IDs
IDs of the planes on the processes.
Array< OneD, unsigned int > Nektar::LibUtilities::Transposition::GetPlanesIDs ( void  )

Definition at line 197 of file Transposition.cpp.

References m_planes_IDs.

198  {
199  return m_planes_IDs;
200  }
Array< OneD, unsigned int > m_planes_IDs
IDs of the planes on the processes.
NekDouble Nektar::LibUtilities::Transposition::GetSpecVanVisc ( const int  k)
void Nektar::LibUtilities::Transposition::SetSpecVanVisc ( Array< OneD, NekDouble visc)
void Nektar::LibUtilities::Transposition::Transpose ( const Array< OneD, const NekDouble > &  inarray,
Array< OneD, NekDouble > &  outarray,
bool  UseNumMode = false,
TranspositionDir  dir = eNoTrans 
)

Main method: General transposition, the dir parameters define if 1D,2D,3D and which transposition is required at the same time

Definition at line 207 of file Transposition.cpp.

References ASSERTL0, Nektar::LibUtilities::eXtoY, Nektar::LibUtilities::eXtoYZ, Nektar::LibUtilities::eXYtoZ, Nektar::LibUtilities::eYtoZ, Nektar::LibUtilities::eYZtoX, Nektar::LibUtilities::eYZtoZY, Nektar::LibUtilities::eZtoX, Nektar::LibUtilities::eZtoXY, Nektar::LibUtilities::eZYtoYZ, TransposeXtoYZ(), TransposeXYtoZ(), TransposeYZtoX(), TransposeYZtoZY(), TransposeZtoXY(), and TransposeZYtoYZ().

211  {
212  switch(dir)
213  {
214  case eXYtoZ:
215  {
216  TransposeXYtoZ(inarray,outarray,UseNumMode);
217  }
218  break;
219  case eZtoXY:
220  {
221  TransposeZtoXY(inarray,outarray,UseNumMode);
222  }
223  break;
224  case eXtoYZ:
225  {
226  TransposeXtoYZ(inarray,outarray,UseNumMode);
227  }
228  break;
229  case eYZtoX:
230  {
231  TransposeYZtoX(inarray,outarray,UseNumMode);
232  }
233  break;
234  case eYZtoZY:
235  {
236  TransposeYZtoZY(inarray,outarray,UseNumMode);
237  }
238  break;
239  case eZYtoYZ:
240  {
241  TransposeZYtoYZ(inarray,outarray,UseNumMode);
242  }
243  break;
244  case eXtoY:
245  {
246  ASSERTL0(false,"Transposition not implemented yet.");
247  }
248  break;
249  case eYtoZ:
250  {
251  ASSERTL0(false,"Transposition not implemented yet.");
252  }
253  break;
254  case eZtoX:
255  {
256  ASSERTL0(false,"Transposition not implemented yet.");
257  }
258  break;
259  default:
260  {
261  ASSERTL0(false,"Transposition type does not exist.");
262  }
263  }
264  }
void TransposeZYtoYZ(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, bool UseNumMode=false)
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:161
void TransposeXYtoZ(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, bool UseNumMode=false)
void TransposeYZtoX(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, bool UseNumMode=false)
void TransposeZtoXY(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, bool UseNumMode=false)
void TransposeXtoYZ(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, bool UseNumMode=false)
void TransposeYZtoZY(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, bool UseNumMode=false)
void Nektar::LibUtilities::Transposition::TransposeXtoYZ ( const Array< OneD, const NekDouble > &  inarray,
Array< OneD, NekDouble > &  outarray,
bool  UseNumMode = false 
)
private

Homogeneous 2D transposition from SEM to Homogeneous(YZ) ordering.

Definition at line 494 of file Transposition.cpp.

References ASSERTL0, ASSERTL1, m_num_homogeneous_coeffs, m_num_homogeneous_points, m_num_processes, and Vmath::Vcopy().

Referenced by Transpose().

498  {
499  if(m_num_processes[0] > 1 || m_num_processes[1] > 1)
500  {
501  ASSERTL0(false,
502  "Parallel transposition not implemented yet for "
503  "3D-Homo-2D approach.");
504  }
505  else
506  {
507  int i, pts_per_line;
508  int n = inarray.num_elements();
509  int packed_len;
510 
511  pts_per_line = n / (m_num_homogeneous_points[0] *
513 
514  if(UseNumMode)
515  {
516  packed_len = (m_num_homogeneous_coeffs[0] *
518  }
519  else
520  {
521  packed_len = (m_num_homogeneous_points[0] *
523  }
524 
525  ASSERTL1(&inarray[0] != &outarray[0],
526  "Inarray and outarray cannot be the same");
527 
528  for(i = 0; i < packed_len; ++i)
529  {
530  Vmath::Vcopy(pts_per_line,
531  &(inarray[i * pts_per_line]), 1,
532  &(outarray[i]), packed_len);
533  }
534  }
535  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:161
Array< OneD, int > m_num_homogeneous_points
Total homogeneous points per direction.
Array< OneD, int > m_num_homogeneous_coeffs
Total number of homogeneous coefficients.
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:191
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1038
void Nektar::LibUtilities::Transposition::TransposeXYtoZ ( const Array< OneD, const NekDouble > &  inarray,
Array< OneD, NekDouble > &  outarray,
bool  UseNumMode = false 
)
private

Homogeneous 1D transposition from SEM to Homogeneous ordering.

Definition at line 270 of file Transposition.cpp.

References ASSERTL1, m_hcomm, m_num_homogeneous_coeffs, m_num_homogeneous_points, m_num_points_per_proc, m_num_processes, m_OffsetMap, m_SizeMap, and Vmath::Vcopy().

Referenced by Transpose().

274  {
275  if(m_num_processes[0] > 1)
276  {
277  // Paramerers set up
278  int i,packed_len;
279  int copy_len = 0;
280  int index = 0;
281  int cnt = 0;
282 
283  int num_dofs = inarray.num_elements();
284  int num_points_per_plane = num_dofs/m_num_points_per_proc[0];
285  int num_pencil_per_proc =
286  (num_points_per_plane / m_num_processes[0]) +
287  (num_points_per_plane % m_num_processes[0] > 0);
288 
289  m_SizeMap = Array<OneD,int> (m_num_processes[0],0);
290  m_OffsetMap = Array<OneD,int> (m_num_processes[0],0);
291 
292  for(i = 0; i < m_num_processes[0]; i++)
293  {
294  m_SizeMap[i] = num_pencil_per_proc *
296  m_OffsetMap[i] = i * num_pencil_per_proc *
297  m_num_points_per_proc[0];
298  }
299 
300  Array< OneD, NekDouble> tmp_outarray(
301  num_pencil_per_proc*m_num_homogeneous_points[0],
302  0.0);
303 
304  if(UseNumMode)
305  {
306  packed_len = m_num_homogeneous_coeffs[0];
307  }
308  else
309  {
310  packed_len = m_num_homogeneous_points[0];
311  }
312 
313  // Start Transposition
314  while(index < num_points_per_plane)
315  {
316  copy_len =
317  num_pencil_per_proc < (num_points_per_plane - index)
318  ? num_pencil_per_proc
319  : (num_points_per_plane - index);
320 
321  for(i = 0 ; i < m_num_points_per_proc[0]; i++)
322  {
323  Vmath::Vcopy(copy_len,
324  &(inarray[index + (i * num_points_per_plane)]), 1,
325  &(outarray[cnt]), 1);
326 
327  cnt += num_pencil_per_proc;
328  }
329 
330  index += copy_len;
331  }
332 
333  m_hcomm->AlltoAllv(outarray, m_SizeMap, m_OffsetMap,
334  tmp_outarray, m_SizeMap, m_OffsetMap);
335 
336  for(i = 0; i < packed_len; ++i)
337  {
338  Vmath::Vcopy(num_pencil_per_proc,
339  &(tmp_outarray[i * num_pencil_per_proc]), 1,
340  &(outarray[i]), packed_len);
341  }
342  // End Transposition
343  }
344 
345  // Serial case implementation (more efficient then MPI 1 processor
346  // implemenation)
347  else
348  {
349  int i, pts_per_plane;
350  int n = inarray.num_elements();
351  int packed_len;
352 
353  pts_per_plane = n/m_num_points_per_proc[0];
354 
355  if(UseNumMode)
356  {
357  packed_len = m_num_homogeneous_coeffs[0];
358  }
359  else
360  {
361  packed_len = m_num_homogeneous_points[0];
362  }
363 
364  ASSERTL1(&inarray[0] != &outarray[0],
365  "Inarray and outarray cannot be the same");
366 
367  for(i = 0; i < packed_len; ++i)
368  {
369  Vmath::Vcopy(pts_per_plane,
370  &(inarray[i * pts_per_plane]), 1,
371  &(outarray[i]), packed_len);
372  }
373  }
374  }
Array< OneD, int > m_num_homogeneous_points
Total homogeneous points per direction.
Array< OneD, int > m_OffsetMap
MPI_Alltoallv offset map of send/recv buffer in global vector.
Array< OneD, int > m_SizeMap
MPI_Alltoallv map containing size of send/recv buffer.
Array< OneD, int > m_num_homogeneous_coeffs
Total number of homogeneous coefficients.
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:191
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1038
Array< OneD, int > m_num_points_per_proc
Number of homogeneous points on each processor per direction.
void Nektar::LibUtilities::Transposition::TransposeYZtoX ( const Array< OneD, const NekDouble > &  inarray,
Array< OneD, NekDouble > &  outarray,
bool  UseNumMode = false 
)
private

Homogeneous 2D transposition from Homogeneous (YZ) ordering to SEM.

Definition at line 541 of file Transposition.cpp.

References ASSERTL0, ASSERTL1, m_num_homogeneous_coeffs, m_num_homogeneous_points, m_num_processes, and Vmath::Vcopy().

Referenced by Transpose().

545  {
546  if(m_num_processes[0] > 1 || m_num_processes[1] > 1)
547  {
548  ASSERTL0(false,
549  "Parallel transposition not implemented yet for "
550  "3D-Homo-2D approach.");
551  }
552  else
553  {
554  int i,pts_per_line;
555  int n = inarray.num_elements();
556  int packed_len;
557 
558  pts_per_line = n / (m_num_homogeneous_points[0] *
560 
561  if(UseNumMode)
562  {
563  packed_len = (m_num_homogeneous_coeffs[0] *
565  }
566  else
567  {
568  packed_len = (m_num_homogeneous_points[0] *
570  }
571 
572  ASSERTL1(&inarray[0] != &outarray[0],
573  "Inarray and outarray cannot be the same");
574 
575  for(i = 0; i < packed_len; ++i)
576  {
577  Vmath::Vcopy(pts_per_line,
578  &(inarray[i]), packed_len,
579  &(outarray[i * pts_per_line]), 1);
580  }
581  }
582  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:161
Array< OneD, int > m_num_homogeneous_points
Total homogeneous points per direction.
Array< OneD, int > m_num_homogeneous_coeffs
Total number of homogeneous coefficients.
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:191
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1038
void Nektar::LibUtilities::Transposition::TransposeYZtoZY ( const Array< OneD, const NekDouble > &  inarray,
Array< OneD, NekDouble > &  outarray,
bool  UseNumMode = false 
)
private

Homogeneous 2D transposition from Y ordering to Z.

Definition at line 588 of file Transposition.cpp.

References ASSERTL0, m_num_homogeneous_points, m_num_processes, and Vmath::Vcopy().

Referenced by Transpose().

592  {
593  if(m_num_processes[0] > 1 || m_num_processes[1] > 1)
594  {
595  ASSERTL0(false,
596  "Parallel transposition not implemented yet for "
597  "3D-Homo-2D approach.");
598  }
599  else
600  {
601  int n = m_num_homogeneous_points[0] *
603  int s = inarray.num_elements();
604 
605  int pts_per_line = s/n;
606 
607  int packed_len = pts_per_line * m_num_homogeneous_points[1];
608 
609  for(int i = 0; i < m_num_homogeneous_points[0] ; ++i)
610  {
611  Vmath::Vcopy(packed_len,
612  &(inarray[i]), m_num_homogeneous_points[0],
613  &(outarray[i * packed_len]), 1);
614  }
615  }
616  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:161
Array< OneD, int > m_num_homogeneous_points
Total homogeneous points per direction.
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1038
void Nektar::LibUtilities::Transposition::TransposeZtoXY ( const Array< OneD, const NekDouble > &  inarray,
Array< OneD, NekDouble > &  outarray,
bool  UseNumMode = false 
)
private

Homogeneous 1D transposition from Homogeneous to SEM ordering.

Definition at line 380 of file Transposition.cpp.

References ASSERTL1, m_hcomm, m_num_homogeneous_coeffs, m_num_homogeneous_points, m_num_points_per_proc, m_num_processes, m_OffsetMap, m_SizeMap, and Vmath::Vcopy().

Referenced by Transpose().

384  {
385  if(m_num_processes[0] > 1)
386  {
387  // Paramerers set up
388  int i,packed_len;
389  int copy_len = 0;
390  int index = 0;
391  int cnt = 0;
392 
393  int num_dofs = outarray.num_elements();
394  int num_points_per_plane = num_dofs / m_num_points_per_proc[0];
395  int num_pencil_per_proc =
396  (num_points_per_plane / m_num_processes[0]) +
397  (num_points_per_plane % m_num_processes[0] > 0);
398 
399  m_SizeMap = Array<OneD,int> (m_num_processes[0],0);
400  m_OffsetMap = Array<OneD,int> (m_num_processes[0],0);
401 
402  for(i = 0; i < m_num_processes[0]; i++)
403  {
404  m_SizeMap[i] = num_pencil_per_proc *
406  m_OffsetMap[i] = i * num_pencil_per_proc *
407  m_num_points_per_proc[0];
408  }
409 
410  Array< OneD, NekDouble> tmp_inarray(
411  num_pencil_per_proc*m_num_homogeneous_points[0],
412  0.0);
413  Array< OneD, NekDouble> tmp_outarray(
414  num_pencil_per_proc*m_num_homogeneous_points[0],
415  0.0);
416 
417  if(UseNumMode)
418  {
419  packed_len = m_num_homogeneous_coeffs[0];
420  }
421  else
422  {
423  packed_len = m_num_homogeneous_points[0];
424  }
425 
426  // Start Transposition
427  for(i = 0; i < packed_len; ++i)
428  {
429  Vmath::Vcopy(num_pencil_per_proc,&(inarray[i]),packed_len,
430  &(tmp_inarray[i*num_pencil_per_proc]),1);
431  }
432 
433  m_hcomm->AlltoAllv(tmp_inarray, m_SizeMap, m_OffsetMap,
434  tmp_outarray, m_SizeMap, m_OffsetMap);
435 
436  while(index < num_points_per_plane)
437  {
438  copy_len =
439  num_pencil_per_proc < (num_points_per_plane - index)
440  ? num_pencil_per_proc
441  : (num_points_per_plane - index);
442 
443  for(i = 0 ; i < m_num_points_per_proc[0]; i++)
444  {
445  Vmath::Vcopy(copy_len,
446  &(tmp_outarray[cnt]), 1,
447  &(outarray[index + (i * num_points_per_plane)]), 1);
448 
449  cnt += num_pencil_per_proc;
450  }
451 
452  index += copy_len;
453  }
454  // End Transposition
455  }
456 
457  // Serial case implementation (more efficient then MPI 1 processor
458  // implemenation)
459  else
460  {
461  int i,pts_per_plane;
462  int n = inarray.num_elements();
463  int packed_len;
464 
465  // use length of inarray to determine data storage type
466  // (i.e.modal or physical).
467  pts_per_plane = n/m_num_points_per_proc[0];
468 
469  if(UseNumMode)
470  {
471  packed_len = m_num_homogeneous_coeffs[0];
472  }
473  else
474  {
475  packed_len = m_num_homogeneous_points[0];
476  }
477 
478  ASSERTL1(&inarray[0] != &outarray[0],
479  "Inarray and outarray cannot be the same");
480 
481  for(i = 0; i < packed_len; ++i)
482  {
483  Vmath::Vcopy(pts_per_plane,
484  &(inarray[i]), packed_len,
485  &(outarray[i * pts_per_plane]), 1);
486  }
487  }
488  }
Array< OneD, int > m_num_homogeneous_points
Total homogeneous points per direction.
Array< OneD, int > m_OffsetMap
MPI_Alltoallv offset map of send/recv buffer in global vector.
Array< OneD, int > m_SizeMap
MPI_Alltoallv map containing size of send/recv buffer.
Array< OneD, int > m_num_homogeneous_coeffs
Total number of homogeneous coefficients.
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:191
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1038
Array< OneD, int > m_num_points_per_proc
Number of homogeneous points on each processor per direction.
void Nektar::LibUtilities::Transposition::TransposeZYtoYZ ( const Array< OneD, const NekDouble > &  inarray,
Array< OneD, NekDouble > &  outarray,
bool  UseNumMode = false 
)
private

Homogeneous 2D transposition from Z ordering to Y.

Definition at line 622 of file Transposition.cpp.

References ASSERTL0, m_num_homogeneous_points, m_num_processes, and Vmath::Vcopy().

Referenced by Transpose().

626  {
627  if(m_num_processes[0] > 1 || m_num_processes[1] > 1)
628  {
629  ASSERTL0(false,
630  "Parallel transposition not implemented yet for "
631  "3D-Homo-2D approach.");
632  }
633  else
634  {
635  int n = m_num_homogeneous_points[0] *
637  int s = inarray.num_elements();
638 
639  int pts_per_line = s/n;
640 
641  int packed_len = pts_per_line * m_num_homogeneous_points[1];
642 
643  for(int i = 0; i < packed_len ; ++i)
644  {
645  Vmath::Vcopy(m_num_homogeneous_points[0],
646  &(inarray[i]), packed_len,
647  &(outarray[i * m_num_homogeneous_points[0]]), 1);
648  }
649  }
650  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:161
Array< OneD, int > m_num_homogeneous_points
Total homogeneous points per direction.
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1038

Member Data Documentation

CommSharedPtr Nektar::LibUtilities::Transposition::m_hcomm
protected

Definition at line 102 of file Transposition.h.

Referenced by TransposeXYtoZ(), TransposeZtoXY(), and Transposition().

Array<OneD, unsigned int> Nektar::LibUtilities::Transposition::m_K
private

Fourier wave numbers associated with the planes.

Definition at line 156 of file Transposition.h.

Referenced by GetK(), GetKs(), and Transposition().

Array<OneD,int> Nektar::LibUtilities::Transposition::m_num_homogeneous_coeffs
private

Total number of homogeneous coefficients.

Definition at line 145 of file Transposition.h.

Referenced by TransposeXtoYZ(), TransposeXYtoZ(), TransposeYZtoX(), TransposeZtoXY(), and Transposition().

int Nektar::LibUtilities::Transposition::m_num_homogeneous_directions
private

Definition at line 136 of file Transposition.h.

Referenced by Transposition().

Array<OneD,int> Nektar::LibUtilities::Transposition::m_num_homogeneous_points
private

Total homogeneous points per direction.

Definition at line 142 of file Transposition.h.

Referenced by TransposeXtoYZ(), TransposeXYtoZ(), TransposeYZtoX(), TransposeYZtoZY(), TransposeZtoXY(), TransposeZYtoYZ(), and Transposition().

Array<OneD,int> Nektar::LibUtilities::Transposition::m_num_points_per_proc
private

Number of homogeneous points on each processor per direction.

Definition at line 139 of file Transposition.h.

Referenced by TransposeXYtoZ(), TransposeZtoXY(), and Transposition().

Array<OneD,int> Nektar::LibUtilities::Transposition::m_num_processes
private
Array<OneD,int> Nektar::LibUtilities::Transposition::m_OffsetMap
private

MPI_Alltoallv offset map of send/recv buffer in global vector.

Definition at line 162 of file Transposition.h.

Referenced by TransposeXYtoZ(), and TransposeZtoXY().

Array<OneD, unsigned int> Nektar::LibUtilities::Transposition::m_planes_IDs
private

IDs of the planes on the processes.

Definition at line 153 of file Transposition.h.

Referenced by GetPlaneID(), GetPlanesIDs(), and Transposition().

int Nektar::LibUtilities::Transposition::m_rank_id
private

Rank of process.

Definition at line 150 of file Transposition.h.

Referenced by Transposition().

Array<OneD,int> Nektar::LibUtilities::Transposition::m_SizeMap
private

MPI_Alltoallv map containing size of send/recv buffer.

Definition at line 159 of file Transposition.h.

Referenced by TransposeXYtoZ(), and TransposeZtoXY().