Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Public Member Functions | Protected Attributes | Private Member Functions | List of all members
Nektar::Collections::PhysDeriv_StdMat Class Reference

Phys deriv operator using standard matrix approach. More...

Inheritance diagram for Nektar::Collections::PhysDeriv_StdMat:
Inheritance graph
[legend]
Collaboration diagram for Nektar::Collections::PhysDeriv_StdMat:
Collaboration graph
[legend]

Public Member Functions

virtual ~PhysDeriv_StdMat ()
 
virtual void operator() (const Array< OneD, const NekDouble > &input, Array< OneD, NekDouble > &output0, Array< OneD, NekDouble > &output1, Array< OneD, NekDouble > &output2, Array< OneD, NekDouble > &wsp)
 Perform operation. More...
 
virtual void operator() (int dir, const Array< OneD, const NekDouble > &input, Array< OneD, NekDouble > &output, Array< OneD, NekDouble > &wsp)
 
- Public Member Functions inherited from Nektar::Collections::Operator
 Operator (std::vector< StdRegions::StdExpansionSharedPtr > pCollExp, boost::shared_ptr< CoalescedGeomData > GeomData)
 Constructor. More...
 
virtual COLLECTIONS_EXPORT ~Operator ()
 
int GetWspSize ()
 Get the size of the required workspace. More...
 

Protected Attributes

Array< OneD, DNekMatSharedPtrm_derivMat
 
Array< TwoD, const NekDoublem_derivFac
 
int m_dim
 
int m_coordim
 
- Protected Attributes inherited from Nektar::Collections::Operator
StdRegions::StdExpansionSharedPtr m_stdExp
 
unsigned int m_numElmt
 
unsigned int m_wspSize
 

Private Member Functions

 PhysDeriv_StdMat (vector< StdRegions::StdExpansionSharedPtr > pCollExp, CoalescedGeomDataSharedPtr pGeomData)
 

Detailed Description

Phys deriv operator using standard matrix approach.

Definition at line 56 of file PhysDeriv.cpp.

Constructor & Destructor Documentation

virtual Nektar::Collections::PhysDeriv_StdMat::~PhysDeriv_StdMat ( )
inlinevirtual

Definition at line 61 of file PhysDeriv.cpp.

62  {
63  }
Nektar::Collections::PhysDeriv_StdMat::PhysDeriv_StdMat ( vector< StdRegions::StdExpansionSharedPtr pCollExp,
CoalescedGeomDataSharedPtr  pGeomData 
)
inlineprivate

Definition at line 152 of file PhysDeriv.cpp.

References Vmath::Vcopy(), and Vmath::Zero().

155  : Operator(pCollExp, pGeomData)
156  {
157  int nqtot = 1;
158  LibUtilities::PointsKeyVector PtsKey = m_stdExp->GetPointsKeys();
159  m_dim = PtsKey.size();
160  m_coordim = m_stdExp->GetCoordim();
161 
162  for(int i = 0; i < m_dim; ++i)
163  {
164  nqtot *= PtsKey[i].GetNumPoints();
165  }
166  // set up a PhysDeriv StdMat.
167  m_derivMat = Array<OneD, DNekMatSharedPtr>(m_dim);
168  for(int i = 0; i < m_dim; ++i)
169  {
170  Array<OneD, NekDouble> tmp(nqtot),tmp1(nqtot);
172  ::AllocateSharedPtr(nqtot,nqtot);
173  for(int j = 0; j < nqtot; ++j)
174  {
175  Vmath::Zero(nqtot,tmp,1);
176  tmp[j] = 1.0;
177  m_stdExp->PhysDeriv(i,tmp,tmp1);
178  Vmath::Vcopy(nqtot, &tmp1[0], 1,
179  &(m_derivMat[i]->GetPtr())[0] + j*nqtot, 1);
180  }
181  }
182  m_derivFac = pGeomData->GetDerivFactors(pCollExp);
183  m_wspSize = 3*nqtot*m_numElmt;
184  }
Operator(std::vector< StdRegions::StdExpansionSharedPtr > pCollExp, boost::shared_ptr< CoalescedGeomData > GeomData)
Constructor.
Definition: Operator.h:112
std::vector< PointsKey > PointsKeyVector
Definition: Points.h:242
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
StdRegions::StdExpansionSharedPtr m_stdExp
Definition: Operator.h:146
Array< OneD, DNekMatSharedPtr > m_derivMat
Definition: PhysDeriv.cpp:146
void Zero(int n, T *x, const int incx)
Zero vector.
Definition: Vmath.cpp:373
Array< TwoD, const NekDouble > m_derivFac
Definition: PhysDeriv.cpp:147
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1061

Member Function Documentation

virtual void Nektar::Collections::PhysDeriv_StdMat::operator() ( const Array< OneD, const NekDouble > &  input,
Array< OneD, NekDouble > &  output0,
Array< OneD, NekDouble > &  output1,
Array< OneD, NekDouble > &  output2,
Array< OneD, NekDouble > &  wsp 
)
inlinevirtual

Perform operation.

Implements Nektar::Collections::Operator.

Definition at line 65 of file PhysDeriv.cpp.

References Vmath::Vvtvp(), and Vmath::Zero().

71  {
72  int nPhys = m_stdExp->GetTotPoints();
73  int ntot = m_numElmt*nPhys;
74  Array<OneD, NekDouble> tmp0,tmp1,tmp2;
75  Array<OneD, Array<OneD, NekDouble> > Diff(3);
76  Array<OneD, Array<OneD, NekDouble> > out(3);
77  out[0] = output0; out[1] = output1; out[2] = output2;
78 
79  for(int i = 0; i < m_dim; ++i)
80  {
81  Diff[i] = wsp + i*ntot;
82  }
83 
84  // calculate local derivatives
85  for(int i = 0; i < m_dim; ++i)
86  {
87  Blas::Dgemm('N', 'N', m_derivMat[i]->GetRows(), m_numElmt,
88  m_derivMat[i]->GetColumns(), 1.0,
89  m_derivMat[i]->GetRawPtr(),
90  m_derivMat[i]->GetRows(), input.get(), nPhys,
91  0.0, &Diff[i][0],nPhys);
92  }
93 
94  // calculate full derivative
95  for(int i = 0; i < m_coordim; ++i)
96  {
97  Vmath::Zero(ntot,out[i],1);
98  for(int j = 0; j < m_dim; ++j)
99  {
100  Vmath::Vvtvp (ntot, m_derivFac[i*m_dim+j], 1,
101  Diff[j], 1,
102  out[i], 1,
103  out[i], 1);
104  }
105  }
106  }
void Vvtvp(int n, const T *w, const int incw, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
vvtvp (vector times vector plus vector): z = w*x + y
Definition: Vmath.cpp:442
StdRegions::StdExpansionSharedPtr m_stdExp
Definition: Operator.h:146
Array< OneD, DNekMatSharedPtr > m_derivMat
Definition: PhysDeriv.cpp:146
void Zero(int n, T *x, const int incx)
Zero vector.
Definition: Vmath.cpp:373
Array< TwoD, const NekDouble > m_derivFac
Definition: PhysDeriv.cpp:147
virtual void Nektar::Collections::PhysDeriv_StdMat::operator() ( int  dir,
const Array< OneD, const NekDouble > &  input,
Array< OneD, NekDouble > &  output,
Array< OneD, NekDouble > &  wsp 
)
inlinevirtual

Implements Nektar::Collections::Operator.

Definition at line 108 of file PhysDeriv.cpp.

References Vmath::Vvtvp(), and Vmath::Zero().

113  {
114  int nPhys = m_stdExp->GetTotPoints();
115  int ntot = m_numElmt*nPhys;
116  Array<OneD, NekDouble> tmp0,tmp1,tmp2;
117  Array<OneD, Array<OneD, NekDouble> > Diff(3);
118 
119  for(int i = 0; i < m_dim; ++i)
120  {
121  Diff[i] = wsp + i*ntot;
122  }
123 
124  // calculate local derivatives
125  for(int i = 0; i < m_dim; ++i)
126  {
127  Blas::Dgemm('N', 'N', m_derivMat[i]->GetRows(), m_numElmt,
128  m_derivMat[i]->GetColumns(), 1.0,
129  m_derivMat[i]->GetRawPtr(),
130  m_derivMat[i]->GetRows(), input.get(), nPhys,
131  0.0, &Diff[i][0],nPhys);
132  }
133 
134  // calculate full derivative
135  Vmath::Zero(ntot,output,1);
136  for(int j = 0; j < m_dim; ++j)
137  {
138  Vmath::Vvtvp (ntot, m_derivFac[dir*m_dim+j], 1,
139  Diff[j], 1,
140  output, 1,
141  output, 1);
142  }
143  }
void Vvtvp(int n, const T *w, const int incw, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
vvtvp (vector times vector plus vector): z = w*x + y
Definition: Vmath.cpp:442
StdRegions::StdExpansionSharedPtr m_stdExp
Definition: Operator.h:146
Array< OneD, DNekMatSharedPtr > m_derivMat
Definition: PhysDeriv.cpp:146
void Zero(int n, T *x, const int incx)
Zero vector.
Definition: Vmath.cpp:373
Array< TwoD, const NekDouble > m_derivFac
Definition: PhysDeriv.cpp:147

Member Data Documentation

int Nektar::Collections::PhysDeriv_StdMat::m_coordim
protected

Definition at line 149 of file PhysDeriv.cpp.

Array<TwoD, const NekDouble> Nektar::Collections::PhysDeriv_StdMat::m_derivFac
protected

Definition at line 147 of file PhysDeriv.cpp.

Array<OneD, DNekMatSharedPtr> Nektar::Collections::PhysDeriv_StdMat::m_derivMat
protected

Definition at line 146 of file PhysDeriv.cpp.

int Nektar::Collections::PhysDeriv_StdMat::m_dim
protected

Definition at line 148 of file PhysDeriv.cpp.