Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 hcomm0, LibUtilities::CommSharedPtr hcomm1)
 
 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)
 
unsigned int GetStripID (void)
 
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...
 
unsigned int m_strip_ID
 IDs of the strips 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  hcomm0,
LibUtilities::CommSharedPtr  hcomm1 
)

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, m_rank_id, and m_strip_ID.

55  {
56  m_hcomm = hcomm1;
58 
60  Array<OneD,int>(m_num_homogeneous_directions);
62  Array<OneD,int>(m_num_homogeneous_directions);
64  Array<OneD,int>(m_num_homogeneous_directions);
66  Array<OneD,int>(m_num_homogeneous_directions);
67 
68  m_num_homogeneous_points[0] = HomoBasis0.GetNumPoints();
69  m_num_homogeneous_coeffs[0] = HomoBasis0.GetNumModes();
70  m_num_processes[0] = m_hcomm->GetSize();
71  m_num_points_per_proc[0] = m_num_homogeneous_points[0] /
72  m_num_processes[0];
73  m_rank_id = m_hcomm->GetRank();
74 
75  //================================================================
76  // TODO: Need to be generalised for 1D, 2D and 3D
77  m_planes_IDs = Array<OneD, unsigned int>(m_num_points_per_proc[0]);
78  m_K = Array<OneD, unsigned int>(m_num_points_per_proc[0]);
79 
80  for(int i = 0 ; i < m_num_points_per_proc[0] ; i++)
81  {
82  m_planes_IDs[i] = m_rank_id*m_num_points_per_proc[0] + i;
83  }
84 
85  int global_rank_id = hcomm0->GetColumnComm()->GetRank();
86  int NumStrips = hcomm0->GetColumnComm()->GetSize() /
87  m_hcomm->GetSize();
88  m_strip_ID = 0;
89 
90  if (NumStrips > 1)
91  {
92  m_strip_ID =
93  (NumStrips > global_rank_id) ? global_rank_id:(global_rank_id - NumStrips);
94  }
95 
96  if(HomoBasis0.GetBasisType() == LibUtilities::eFourier)
97  {
98  for(int i = 0 ; i < m_num_points_per_proc[0] ; i++)
99  {
100  m_K[i] = m_planes_IDs[i]/2;
101  }
102  }
103 
104  if(HomoBasis0.GetBasisType() == LibUtilities::eFourierSingleMode)
105  {
106  m_K[0] = 1;
107  m_K[1] = 1;
108  }
109 
110  if(HomoBasis0.GetBasisType() == LibUtilities::eFourierHalfModeRe ||
111  HomoBasis0.GetBasisType() == LibUtilities::eFourierHalfModeIm)
112  {
113  m_K[0]=1;
114  }
115  //================================================================
116  }
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
unsigned int m_strip_ID
IDs of the strips on the processes.
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 122 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.

125  {
126  m_hcomm = hcomm;
128 
130  Array<OneD,int>(m_num_homogeneous_directions);
132  Array<OneD,int>(m_num_homogeneous_directions);
134  Array<OneD,int>(m_num_homogeneous_directions);
136  Array<OneD,int>(m_num_homogeneous_directions);
137 
138  m_num_homogeneous_points[0] = HomoBasis0.GetNumPoints();
139  m_num_homogeneous_coeffs[0] = HomoBasis0.GetNumModes();
140  m_num_homogeneous_points[1] = HomoBasis1.GetNumPoints();
141  m_num_homogeneous_coeffs[1] = HomoBasis1.GetNumModes();
142 
143  m_num_processes[0] = m_hcomm->GetRowComm()->GetSize();
144  m_num_processes[1] = m_hcomm->GetColumnComm()->GetSize();
145 
146  m_num_points_per_proc[0] = m_num_homogeneous_points[0] /
147  m_num_processes[0];
148  m_num_points_per_proc[1] = m_num_homogeneous_points[1] /
149  m_num_processes[1];
150 
151  //================================================================
152  // TODO: Need set up for 2D lines IDs and Ks if Fourier
153  //================================================================
154  }
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 160 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.

164  {
165  m_hcomm = hcomm;
167 
169  Array<OneD,int>(m_num_homogeneous_directions);
171  Array<OneD,int>(m_num_homogeneous_directions);
173  Array<OneD,int>(m_num_homogeneous_directions);
175  Array<OneD,int>(m_num_homogeneous_directions);
176 
177  //================================================================
178  // TODO: Need set up for 3D
179  ASSERTL0(false, "Transposition is not set up for 3D.");
180  //================================================================
181  }
#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 187 of file Transposition.cpp.

188  {
189 
190  }

Member Function Documentation

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

Definition at line 194 of file Transposition.cpp.

References m_K.

195  {
196  return m_K[i];
197  }
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 199 of file Transposition.cpp.

References m_K.

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

Definition at line 204 of file Transposition.cpp.

References m_planes_IDs.

205  {
206  return m_planes_IDs[i];
207  }
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 209 of file Transposition.cpp.

References m_planes_IDs.

210  {
211  return m_planes_IDs;
212  }
Array< OneD, unsigned int > m_planes_IDs
IDs of the planes on the processes.
NekDouble Nektar::LibUtilities::Transposition::GetSpecVanVisc ( const int  k)
unsigned int Nektar::LibUtilities::Transposition::GetStripID ( void  )

Definition at line 214 of file Transposition.cpp.

References m_strip_ID.

215  {
216  return m_strip_ID;
217  }
unsigned int m_strip_ID
IDs of the strips on the processes.
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 223 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().

227  {
228  switch(dir)
229  {
230  case eXYtoZ:
231  {
232  TransposeXYtoZ(inarray,outarray,UseNumMode);
233  }
234  break;
235  case eZtoXY:
236  {
237  TransposeZtoXY(inarray,outarray,UseNumMode);
238  }
239  break;
240  case eXtoYZ:
241  {
242  TransposeXtoYZ(inarray,outarray,UseNumMode);
243  }
244  break;
245  case eYZtoX:
246  {
247  TransposeYZtoX(inarray,outarray,UseNumMode);
248  }
249  break;
250  case eYZtoZY:
251  {
252  TransposeYZtoZY(inarray,outarray,UseNumMode);
253  }
254  break;
255  case eZYtoYZ:
256  {
257  TransposeZYtoYZ(inarray,outarray,UseNumMode);
258  }
259  break;
260  case eXtoY:
261  {
262  ASSERTL0(false,"Transposition not implemented yet.");
263  }
264  break;
265  case eYtoZ:
266  {
267  ASSERTL0(false,"Transposition not implemented yet.");
268  }
269  break;
270  case eZtoX:
271  {
272  ASSERTL0(false,"Transposition not implemented yet.");
273  }
274  break;
275  default:
276  {
277  ASSERTL0(false,"Transposition type does not exist.");
278  }
279  }
280  }
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 510 of file Transposition.cpp.

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

Referenced by Transpose().

514  {
515  if(m_num_processes[0] > 1 || m_num_processes[1] > 1)
516  {
517  ASSERTL0(false,
518  "Parallel transposition not implemented yet for "
519  "3D-Homo-2D approach.");
520  }
521  else
522  {
523  int i, pts_per_line;
524  int n = inarray.num_elements();
525  int packed_len;
526 
527  pts_per_line = n / (m_num_homogeneous_points[0] *
529 
530  if(UseNumMode)
531  {
532  packed_len = (m_num_homogeneous_coeffs[0] *
534  }
535  else
536  {
537  packed_len = (m_num_homogeneous_points[0] *
539  }
540 
541  ASSERTL1(&inarray[0] != &outarray[0],
542  "Inarray and outarray cannot be the same");
543 
544  for(i = 0; i < packed_len; ++i)
545  {
546  Vmath::Vcopy(pts_per_line,
547  &(inarray[i * pts_per_line]), 1,
548  &(outarray[i]), packed_len);
549  }
550  }
551  }
#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:1047
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 286 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().

290  {
291  if(m_num_processes[0] > 1)
292  {
293  // Paramerers set up
294  int i,packed_len;
295  int copy_len = 0;
296  int index = 0;
297  int cnt = 0;
298 
299  int num_dofs = inarray.num_elements();
300  int num_points_per_plane = num_dofs/m_num_points_per_proc[0];
301  int num_pencil_per_proc =
302  (num_points_per_plane / m_num_processes[0]) +
303  (num_points_per_plane % m_num_processes[0] > 0);
304 
305  m_SizeMap = Array<OneD,int> (m_num_processes[0],0);
306  m_OffsetMap = Array<OneD,int> (m_num_processes[0],0);
307 
308  for(i = 0; i < m_num_processes[0]; i++)
309  {
310  m_SizeMap[i] = num_pencil_per_proc *
312  m_OffsetMap[i] = i * num_pencil_per_proc *
313  m_num_points_per_proc[0];
314  }
315 
316  Array< OneD, NekDouble> tmp_outarray(
317  num_pencil_per_proc*m_num_homogeneous_points[0],
318  0.0);
319 
320  if(UseNumMode)
321  {
322  packed_len = m_num_homogeneous_coeffs[0];
323  }
324  else
325  {
326  packed_len = m_num_homogeneous_points[0];
327  }
328 
329  // Start Transposition
330  while(index < num_points_per_plane)
331  {
332  copy_len =
333  num_pencil_per_proc < (num_points_per_plane - index)
334  ? num_pencil_per_proc
335  : (num_points_per_plane - index);
336 
337  for(i = 0 ; i < m_num_points_per_proc[0]; i++)
338  {
339  Vmath::Vcopy(copy_len,
340  &(inarray[index + (i * num_points_per_plane)]), 1,
341  &(outarray[cnt]), 1);
342 
343  cnt += num_pencil_per_proc;
344  }
345 
346  index += copy_len;
347  }
348 
349  m_hcomm->AlltoAllv(outarray, m_SizeMap, m_OffsetMap,
350  tmp_outarray, m_SizeMap, m_OffsetMap);
351 
352  for(i = 0; i < packed_len; ++i)
353  {
354  Vmath::Vcopy(num_pencil_per_proc,
355  &(tmp_outarray[i * num_pencil_per_proc]), 1,
356  &(outarray[i]), packed_len);
357  }
358  // End Transposition
359  }
360 
361  // Serial case implementation (more efficient then MPI 1 processor
362  // implemenation)
363  else
364  {
365  int i, pts_per_plane;
366  int n = inarray.num_elements();
367  int packed_len;
368 
369  pts_per_plane = n/m_num_points_per_proc[0];
370 
371  if(UseNumMode)
372  {
373  packed_len = m_num_homogeneous_coeffs[0];
374  }
375  else
376  {
377  packed_len = m_num_homogeneous_points[0];
378  }
379 
380  ASSERTL1(&inarray[0] != &outarray[0],
381  "Inarray and outarray cannot be the same");
382 
383  for(i = 0; i < packed_len; ++i)
384  {
385  Vmath::Vcopy(pts_per_plane,
386  &(inarray[i * pts_per_plane]), 1,
387  &(outarray[i]), packed_len);
388  }
389  }
390  }
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:1047
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 557 of file Transposition.cpp.

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

Referenced by Transpose().

561  {
562  if(m_num_processes[0] > 1 || m_num_processes[1] > 1)
563  {
564  ASSERTL0(false,
565  "Parallel transposition not implemented yet for "
566  "3D-Homo-2D approach.");
567  }
568  else
569  {
570  int i,pts_per_line;
571  int n = inarray.num_elements();
572  int packed_len;
573 
574  pts_per_line = n / (m_num_homogeneous_points[0] *
576 
577  if(UseNumMode)
578  {
579  packed_len = (m_num_homogeneous_coeffs[0] *
581  }
582  else
583  {
584  packed_len = (m_num_homogeneous_points[0] *
586  }
587 
588  ASSERTL1(&inarray[0] != &outarray[0],
589  "Inarray and outarray cannot be the same");
590 
591  for(i = 0; i < packed_len; ++i)
592  {
593  Vmath::Vcopy(pts_per_line,
594  &(inarray[i]), packed_len,
595  &(outarray[i * pts_per_line]), 1);
596  }
597  }
598  }
#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:1047
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 604 of file Transposition.cpp.

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

Referenced by Transpose().

608  {
609  if(m_num_processes[0] > 1 || m_num_processes[1] > 1)
610  {
611  ASSERTL0(false,
612  "Parallel transposition not implemented yet for "
613  "3D-Homo-2D approach.");
614  }
615  else
616  {
617  int n = m_num_homogeneous_points[0] *
619  int s = inarray.num_elements();
620 
621  int pts_per_line = s/n;
622 
623  int packed_len = pts_per_line * m_num_homogeneous_points[1];
624 
625  for(int i = 0; i < m_num_homogeneous_points[0] ; ++i)
626  {
627  Vmath::Vcopy(packed_len,
628  &(inarray[i]), m_num_homogeneous_points[0],
629  &(outarray[i * packed_len]), 1);
630  }
631  }
632  }
#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:1047
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 396 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().

400  {
401  if(m_num_processes[0] > 1)
402  {
403  // Paramerers set up
404  int i,packed_len;
405  int copy_len = 0;
406  int index = 0;
407  int cnt = 0;
408 
409  int num_dofs = outarray.num_elements();
410  int num_points_per_plane = num_dofs / m_num_points_per_proc[0];
411  int num_pencil_per_proc =
412  (num_points_per_plane / m_num_processes[0]) +
413  (num_points_per_plane % m_num_processes[0] > 0);
414 
415  m_SizeMap = Array<OneD,int> (m_num_processes[0],0);
416  m_OffsetMap = Array<OneD,int> (m_num_processes[0],0);
417 
418  for(i = 0; i < m_num_processes[0]; i++)
419  {
420  m_SizeMap[i] = num_pencil_per_proc *
422  m_OffsetMap[i] = i * num_pencil_per_proc *
423  m_num_points_per_proc[0];
424  }
425 
426  Array< OneD, NekDouble> tmp_inarray(
427  num_pencil_per_proc*m_num_homogeneous_points[0],
428  0.0);
429  Array< OneD, NekDouble> tmp_outarray(
430  num_pencil_per_proc*m_num_homogeneous_points[0],
431  0.0);
432 
433  if(UseNumMode)
434  {
435  packed_len = m_num_homogeneous_coeffs[0];
436  }
437  else
438  {
439  packed_len = m_num_homogeneous_points[0];
440  }
441 
442  // Start Transposition
443  for(i = 0; i < packed_len; ++i)
444  {
445  Vmath::Vcopy(num_pencil_per_proc,&(inarray[i]),packed_len,
446  &(tmp_inarray[i*num_pencil_per_proc]),1);
447  }
448 
449  m_hcomm->AlltoAllv(tmp_inarray, m_SizeMap, m_OffsetMap,
450  tmp_outarray, m_SizeMap, m_OffsetMap);
451 
452  while(index < num_points_per_plane)
453  {
454  copy_len =
455  num_pencil_per_proc < (num_points_per_plane - index)
456  ? num_pencil_per_proc
457  : (num_points_per_plane - index);
458 
459  for(i = 0 ; i < m_num_points_per_proc[0]; i++)
460  {
461  Vmath::Vcopy(copy_len,
462  &(tmp_outarray[cnt]), 1,
463  &(outarray[index + (i * num_points_per_plane)]), 1);
464 
465  cnt += num_pencil_per_proc;
466  }
467 
468  index += copy_len;
469  }
470  // End Transposition
471  }
472 
473  // Serial case implementation (more efficient then MPI 1 processor
474  // implemenation)
475  else
476  {
477  int i,pts_per_plane;
478  int n = inarray.num_elements();
479  int packed_len;
480 
481  // use length of inarray to determine data storage type
482  // (i.e.modal or physical).
483  pts_per_plane = n/m_num_points_per_proc[0];
484 
485  if(UseNumMode)
486  {
487  packed_len = m_num_homogeneous_coeffs[0];
488  }
489  else
490  {
491  packed_len = m_num_homogeneous_points[0];
492  }
493 
494  ASSERTL1(&inarray[0] != &outarray[0],
495  "Inarray and outarray cannot be the same");
496 
497  for(i = 0; i < packed_len; ++i)
498  {
499  Vmath::Vcopy(pts_per_plane,
500  &(inarray[i]), packed_len,
501  &(outarray[i * pts_per_plane]), 1);
502  }
503  }
504  }
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:1047
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 638 of file Transposition.cpp.

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

Referenced by Transpose().

642  {
643  if(m_num_processes[0] > 1 || m_num_processes[1] > 1)
644  {
645  ASSERTL0(false,
646  "Parallel transposition not implemented yet for "
647  "3D-Homo-2D approach.");
648  }
649  else
650  {
651  int n = m_num_homogeneous_points[0] *
653  int s = inarray.num_elements();
654 
655  int pts_per_line = s/n;
656 
657  int packed_len = pts_per_line * m_num_homogeneous_points[1];
658 
659  for(int i = 0; i < packed_len ; ++i)
660  {
661  Vmath::Vcopy(m_num_homogeneous_points[0],
662  &(inarray[i]), packed_len,
663  &(outarray[i * m_num_homogeneous_points[0]]), 1);
664  }
665  }
666  }
#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:1047

Member Data Documentation

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

Definition at line 105 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 162 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 148 of file Transposition.h.

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

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

Definition at line 139 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 145 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 142 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 168 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 156 of file Transposition.h.

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

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

Rank of process.

Definition at line 153 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 165 of file Transposition.h.

Referenced by TransposeXYtoZ(), and TransposeZtoXY().

unsigned int Nektar::LibUtilities::Transposition::m_strip_ID
private

IDs of the strips on the processes.

Definition at line 159 of file Transposition.h.

Referenced by GetStripID(), and Transposition().