Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties 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 69 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 51 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.

54 {
55  m_hcomm = hcomm1;
57 
62 
63  m_num_homogeneous_points[0] = HomoBasis0.GetNumPoints();
64  m_num_homogeneous_coeffs[0] = HomoBasis0.GetNumModes();
65  m_num_processes[0] = m_hcomm->GetSize();
66  m_num_points_per_proc[0] = m_num_homogeneous_points[0] / m_num_processes[0];
67  m_rank_id = m_hcomm->GetRank();
68 
69  //================================================================
70  // TODO: Need to be generalised for 1D, 2D and 3D
71  m_planes_IDs = Array<OneD, unsigned int>(m_num_points_per_proc[0]);
72  m_K = Array<OneD, unsigned int>(m_num_points_per_proc[0]);
73 
74  for (int i = 0; i < m_num_points_per_proc[0]; i++)
75  {
76  m_planes_IDs[i] = m_rank_id * m_num_points_per_proc[0] + i;
77  }
78 
79  int global_rank_id = hcomm0->GetColumnComm()->GetRank();
80  int NumStrips = hcomm0->GetColumnComm()->GetSize() / m_hcomm->GetSize();
81  m_strip_ID = 0;
82 
83  if (NumStrips > 1)
84  {
85  m_strip_ID = (NumStrips > global_rank_id)
86  ? global_rank_id
87  : (global_rank_id - NumStrips);
88  }
89 
90  if (HomoBasis0.GetBasisType() == LibUtilities::eFourier)
91  {
92  for (int i = 0; i < m_num_points_per_proc[0]; i++)
93  {
94  m_K[i] = m_planes_IDs[i] / 2;
95  }
96  }
97 
98  if (HomoBasis0.GetBasisType() == LibUtilities::eFourierSingleMode)
99  {
100  m_K[0] = 1;
101  m_K[1] = 1;
102  }
103 
104  if (HomoBasis0.GetBasisType() == LibUtilities::eFourierHalfModeRe ||
105  HomoBasis0.GetBasisType() == LibUtilities::eFourierHalfModeIm)
106  {
107  m_K[0] = 1;
108  }
109  //================================================================
110 }
Array< OneD, int > m_num_homogeneous_points
Total homogeneous points per direction.
Array< OneD, int > m_num_points_per_proc
Number of homogeneous points on each processor 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.
Fourier ModifiedExpansion with just the first mode .
Definition: BasisType.h:58
Array< OneD, int > m_num_homogeneous_coeffs
Total number of homogeneous coefficients.
Nektar::LibUtilities::Transposition::Transposition ( const LibUtilities::BasisKey HomoBasis0,
const LibUtilities::BasisKey HomoBasis1,
LibUtilities::CommSharedPtr  hcomm 
)

Constructor for 2D transform.

Definition at line 115 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.

118 {
119  m_hcomm = hcomm;
121 
125  m_num_processes = Array<OneD, int>(m_num_homogeneous_directions);
126 
127  m_num_homogeneous_points[0] = HomoBasis0.GetNumPoints();
128  m_num_homogeneous_coeffs[0] = HomoBasis0.GetNumModes();
129  m_num_homogeneous_points[1] = HomoBasis1.GetNumPoints();
130  m_num_homogeneous_coeffs[1] = HomoBasis1.GetNumModes();
131 
132  m_num_processes[0] = m_hcomm->GetRowComm()->GetSize();
133  m_num_processes[1] = m_hcomm->GetColumnComm()->GetSize();
134 
135  m_num_points_per_proc[0] = m_num_homogeneous_points[0] / m_num_processes[0];
136  m_num_points_per_proc[1] = m_num_homogeneous_points[1] / m_num_processes[1];
137 
138  //================================================================
139  // TODO: Need set up for 2D lines IDs and Ks if Fourier
140  //================================================================
141 }
Array< OneD, int > m_num_homogeneous_points
Total homogeneous points per direction.
Array< OneD, int > m_num_points_per_proc
Number of homogeneous points on each processor per direction.
Array< OneD, int > m_num_homogeneous_coeffs
Total number of homogeneous coefficients.
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 146 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.

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

Destructor

Definition at line 168 of file Transposition.cpp.

169 {
170 }

Member Function Documentation

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

Definition at line 174 of file Transposition.cpp.

References m_K.

175 {
176  return m_K[i];
177 }
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 179 of file Transposition.cpp.

References m_K.

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

Definition at line 184 of file Transposition.cpp.

References m_planes_IDs.

185 {
186  return m_planes_IDs[i];
187 }
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 189 of file Transposition.cpp.

References m_planes_IDs.

190 {
191  return m_planes_IDs;
192 }
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 194 of file Transposition.cpp.

References m_strip_ID.

195 {
196  return m_strip_ID;
197 }
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 203 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().

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

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

Referenced by Transpose().

476 {
477  if (m_num_processes[0] > 1 || m_num_processes[1] > 1)
478  {
479  ASSERTL0(false, "Parallel transposition not implemented yet for "
480  "3D-Homo-2D approach.");
481  }
482  else
483  {
484  int i, pts_per_line;
485  int n = inarray.num_elements();
486  int packed_len;
487 
488  pts_per_line =
490 
491  if (UseNumMode)
492  {
493  packed_len =
495  }
496  else
497  {
498  packed_len =
500  }
501 
502  ASSERTL1(&inarray[0] != &outarray[0],
503  "Inarray and outarray cannot be the same");
504 
505  for (i = 0; i < packed_len; ++i)
506  {
507  Vmath::Vcopy(pts_per_line, &(inarray[i * pts_per_line]), 1,
508  &(outarray[i]), packed_len);
509  }
510  }
511 }
Array< OneD, int > m_num_homogeneous_points
Total homogeneous points per direction.
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:198
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:228
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1061
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 264 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().

267 {
268  if (m_num_processes[0] > 1)
269  {
270  // Paramerers set up
271  int i, packed_len;
272  int copy_len = 0;
273  int index = 0;
274  int cnt = 0;
275 
276  int num_dofs = inarray.num_elements();
277  int num_points_per_plane = num_dofs / m_num_points_per_proc[0];
278  int num_pencil_per_proc =
279  (num_points_per_plane / m_num_processes[0]) +
280  (num_points_per_plane % m_num_processes[0] > 0);
281 
282  m_SizeMap = Array<OneD, int>(m_num_processes[0], 0);
283  m_OffsetMap = Array<OneD, int>(m_num_processes[0], 0);
284 
285  for (i = 0; i < m_num_processes[0]; i++)
286  {
287  m_SizeMap[i] = num_pencil_per_proc * m_num_points_per_proc[0];
288  m_OffsetMap[i] = i * num_pencil_per_proc * m_num_points_per_proc[0];
289  }
290 
291  Array<OneD, NekDouble> tmp_outarray(
292  num_pencil_per_proc * m_num_homogeneous_points[0], 0.0);
293 
294  if (UseNumMode)
295  {
296  packed_len = m_num_homogeneous_coeffs[0];
297  }
298  else
299  {
300  packed_len = m_num_homogeneous_points[0];
301  }
302 
303  // Start Transposition
304  while (index < num_points_per_plane)
305  {
306  copy_len = num_pencil_per_proc < (num_points_per_plane - index)
307  ? num_pencil_per_proc
308  : (num_points_per_plane - index);
309 
310  for (i = 0; i < m_num_points_per_proc[0]; i++)
311  {
312  Vmath::Vcopy(copy_len,
313  &(inarray[index + (i * num_points_per_plane)]), 1,
314  &(outarray[cnt]), 1);
315 
316  cnt += num_pencil_per_proc;
317  }
318 
319  index += copy_len;
320  }
321 
322  m_hcomm->AlltoAllv(outarray, m_SizeMap, m_OffsetMap, tmp_outarray,
323  m_SizeMap, m_OffsetMap);
324 
325  for (i = 0; i < packed_len; ++i)
326  {
327  Vmath::Vcopy(num_pencil_per_proc,
328  &(tmp_outarray[i * num_pencil_per_proc]), 1,
329  &(outarray[i]), packed_len);
330  }
331  // End Transposition
332  }
333 
334  // Serial case implementation (more efficient then MPI 1 processor
335  // implemenation)
336  else
337  {
338  int i, pts_per_plane;
339  int n = inarray.num_elements();
340  int packed_len;
341 
342  pts_per_plane = n / m_num_points_per_proc[0];
343 
344  if (UseNumMode)
345  {
346  packed_len = m_num_homogeneous_coeffs[0];
347  }
348  else
349  {
350  packed_len = m_num_homogeneous_points[0];
351  }
352 
353  ASSERTL1(&inarray[0] != &outarray[0],
354  "Inarray and outarray cannot be the same");
355 
356  for (i = 0; i < packed_len; ++i)
357  {
358  Vmath::Vcopy(pts_per_plane, &(inarray[i * pts_per_plane]), 1,
359  &(outarray[i]), packed_len);
360  }
361  }
362 }
Array< OneD, int > m_num_homogeneous_points
Total homogeneous points per direction.
Array< OneD, int > m_num_points_per_proc
Number of homogeneous points on each processor per direction.
Array< OneD, int > m_SizeMap
MPI_Alltoallv map containing size of send/recv buffer.
Array< OneD, int > m_OffsetMap
MPI_Alltoallv offset map of send/recv buffer in global vector.
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:228
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1061
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 516 of file Transposition.cpp.

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

Referenced by Transpose().

519 {
520  if (m_num_processes[0] > 1 || m_num_processes[1] > 1)
521  {
522  ASSERTL0(false, "Parallel transposition not implemented yet for "
523  "3D-Homo-2D approach.");
524  }
525  else
526  {
527  int i, pts_per_line;
528  int n = inarray.num_elements();
529  int packed_len;
530 
531  pts_per_line =
533 
534  if (UseNumMode)
535  {
536  packed_len =
538  }
539  else
540  {
541  packed_len =
543  }
544 
545  ASSERTL1(&inarray[0] != &outarray[0],
546  "Inarray and outarray cannot be the same");
547 
548  for (i = 0; i < packed_len; ++i)
549  {
550  Vmath::Vcopy(pts_per_line, &(inarray[i]), packed_len,
551  &(outarray[i * pts_per_line]), 1);
552  }
553  }
554 }
Array< OneD, int > m_num_homogeneous_points
Total homogeneous points per direction.
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:198
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:228
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1061
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 559 of file Transposition.cpp.

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

Referenced by Transpose().

562 {
563  if (m_num_processes[0] > 1 || m_num_processes[1] > 1)
564  {
565  ASSERTL0(false, "Parallel transposition not implemented yet for "
566  "3D-Homo-2D approach.");
567  }
568  else
569  {
571  int s = inarray.num_elements();
572 
573  int pts_per_line = s / n;
574 
575  int packed_len = pts_per_line * m_num_homogeneous_points[1];
576 
577  for (int i = 0; i < m_num_homogeneous_points[0]; ++i)
578  {
579  Vmath::Vcopy(packed_len, &(inarray[i]), m_num_homogeneous_points[0],
580  &(outarray[i * packed_len]), 1);
581  }
582  }
583 }
Array< OneD, int > m_num_homogeneous_points
Total homogeneous points per direction.
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:198
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1061
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 367 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().

370 {
371  if (m_num_processes[0] > 1)
372  {
373  // Paramerers set up
374  int i, packed_len;
375  int copy_len = 0;
376  int index = 0;
377  int cnt = 0;
378 
379  int num_dofs = outarray.num_elements();
380  int num_points_per_plane = num_dofs / m_num_points_per_proc[0];
381  int num_pencil_per_proc =
382  (num_points_per_plane / m_num_processes[0]) +
383  (num_points_per_plane % m_num_processes[0] > 0);
384 
385  m_SizeMap = Array<OneD, int>(m_num_processes[0], 0);
386  m_OffsetMap = Array<OneD, int>(m_num_processes[0], 0);
387 
388  for (i = 0; i < m_num_processes[0]; i++)
389  {
390  m_SizeMap[i] = num_pencil_per_proc * m_num_points_per_proc[0];
391  m_OffsetMap[i] = i * num_pencil_per_proc * m_num_points_per_proc[0];
392  }
393 
394  Array<OneD, NekDouble> tmp_inarray(
395  num_pencil_per_proc * m_num_homogeneous_points[0], 0.0);
396  Array<OneD, NekDouble> tmp_outarray(
397  num_pencil_per_proc * m_num_homogeneous_points[0], 0.0);
398 
399  if (UseNumMode)
400  {
401  packed_len = m_num_homogeneous_coeffs[0];
402  }
403  else
404  {
405  packed_len = m_num_homogeneous_points[0];
406  }
407 
408  // Start Transposition
409  for (i = 0; i < packed_len; ++i)
410  {
411  Vmath::Vcopy(num_pencil_per_proc, &(inarray[i]), packed_len,
412  &(tmp_inarray[i * num_pencil_per_proc]), 1);
413  }
414 
415  m_hcomm->AlltoAllv(tmp_inarray, m_SizeMap, m_OffsetMap, tmp_outarray,
416  m_SizeMap, m_OffsetMap);
417 
418  while (index < num_points_per_plane)
419  {
420  copy_len = num_pencil_per_proc < (num_points_per_plane - index)
421  ? num_pencil_per_proc
422  : (num_points_per_plane - index);
423 
424  for (i = 0; i < m_num_points_per_proc[0]; i++)
425  {
426  Vmath::Vcopy(copy_len, &(tmp_outarray[cnt]), 1,
427  &(outarray[index + (i * num_points_per_plane)]),
428  1);
429 
430  cnt += num_pencil_per_proc;
431  }
432 
433  index += copy_len;
434  }
435  // End Transposition
436  }
437 
438  // Serial case implementation (more efficient then MPI 1 processor
439  // implemenation)
440  else
441  {
442  int i, pts_per_plane;
443  int n = inarray.num_elements();
444  int packed_len;
445 
446  // use length of inarray to determine data storage type
447  // (i.e.modal or physical).
448  pts_per_plane = n / m_num_points_per_proc[0];
449 
450  if (UseNumMode)
451  {
452  packed_len = m_num_homogeneous_coeffs[0];
453  }
454  else
455  {
456  packed_len = m_num_homogeneous_points[0];
457  }
458 
459  ASSERTL1(&inarray[0] != &outarray[0],
460  "Inarray and outarray cannot be the same");
461 
462  for (i = 0; i < packed_len; ++i)
463  {
464  Vmath::Vcopy(pts_per_plane, &(inarray[i]), packed_len,
465  &(outarray[i * pts_per_plane]), 1);
466  }
467  }
468 }
Array< OneD, int > m_num_homogeneous_points
Total homogeneous points per direction.
Array< OneD, int > m_num_points_per_proc
Number of homogeneous points on each processor per direction.
Array< OneD, int > m_SizeMap
MPI_Alltoallv map containing size of send/recv buffer.
Array< OneD, int > m_OffsetMap
MPI_Alltoallv offset map of send/recv buffer in global vector.
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:228
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1061
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 588 of file Transposition.cpp.

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

Referenced by Transpose().

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

Member Data Documentation

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

Definition at line 107 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 157 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 143 of file Transposition.h.

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

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

Definition at line 134 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 140 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 137 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 163 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 151 of file Transposition.h.

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

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

Rank of process.

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

Referenced by GetStripID(), and Transposition().