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_SumFac_Tet Class Reference

Phys deriv operator using sum-factorisation (Tet) More...

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

Public Member Functions

virtual ~PhysDeriv_SumFac_Tet ()
 
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< TwoD, const NekDoublem_derivFac
 
int m_dim
 
int m_coordim
 
const int m_nquad0
 
const int m_nquad1
 
const int m_nquad2
 
NekDoublem_Deriv0
 
NekDoublem_Deriv1
 
NekDoublem_Deriv2
 
Array< OneD, NekDoublem_fac0
 
Array< OneD, NekDoublem_fac1
 
Array< OneD, NekDoublem_fac2
 
Array< OneD, NekDoublem_fac3
 
- Protected Attributes inherited from Nektar::Collections::Operator
StdRegions::StdExpansionSharedPtr m_stdExp
 
unsigned int m_numElmt
 
unsigned int m_wspSize
 

Private Member Functions

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

Detailed Description

Phys deriv operator using sum-factorisation (Tet)

Definition at line 1076 of file PhysDeriv.cpp.

Constructor & Destructor Documentation

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

Definition at line 1081 of file PhysDeriv.cpp.

1082  {
1083  }
Nektar::Collections::PhysDeriv_SumFac_Tet::PhysDeriv_SumFac_Tet ( vector< StdRegions::StdExpansionSharedPtr pCollExp,
CoalescedGeomDataSharedPtr  pGeomData 
)
inlineprivate

Definition at line 1271 of file PhysDeriv.cpp.

1274  : Operator(pCollExp, pGeomData),
1275  m_nquad0 (m_stdExp->GetNumPoints(0)),
1276  m_nquad1 (m_stdExp->GetNumPoints(1)),
1277  m_nquad2 (m_stdExp->GetNumPoints(2))
1278  {
1279  LibUtilities::PointsKeyVector PtsKey = m_stdExp->GetPointsKeys();
1280 
1281  m_dim = PtsKey.size();
1282  m_coordim = m_stdExp->GetCoordim();
1283 
1284  m_derivFac = pGeomData->GetDerivFactors(pCollExp);
1285 
1286  m_Deriv0 = &((m_stdExp->GetBasis(0)->GetD())->GetPtr())[0];
1287  m_Deriv1 = &((m_stdExp->GetBasis(1)->GetD())->GetPtr())[0];
1288  m_Deriv2 = &((m_stdExp->GetBasis(2)->GetD())->GetPtr())[0];
1289 
1291 
1292  const Array<OneD, const NekDouble>& z0
1293  = m_stdExp->GetBasis(0)->GetZ();
1294  const Array<OneD, const NekDouble>& z1
1295  = m_stdExp->GetBasis(1)->GetZ();
1296  const Array<OneD, const NekDouble>& z2
1297  = m_stdExp->GetBasis(2)->GetZ();
1298 
1299  m_fac0 = Array<OneD, NekDouble>(m_nquad0*m_nquad1*m_nquad2);
1300  m_fac1 = Array<OneD, NekDouble>(m_nquad0*m_nquad1*m_nquad2);
1301  m_fac2 = Array<OneD, NekDouble>(m_nquad0*m_nquad1*m_nquad2);
1302  m_fac3 = Array<OneD, NekDouble>(m_nquad0*m_nquad1*m_nquad2);
1303  // calculate 2.0/((1-eta_1)(1-eta_2))
1304  for (int i = 0; i < m_nquad0; ++i)
1305  {
1306  for(int j = 0; j < m_nquad1; ++j)
1307  {
1308  for(int k = 0; k < m_nquad2; ++k)
1309  {
1310 
1311  m_fac0[i + j*m_nquad0 + k*m_nquad0*m_nquad1]
1312  = 4.0/((1-z1[j])*(1-z2[k]));
1313  m_fac1[i + j*m_nquad0 + k*m_nquad0*m_nquad1]
1314  = 2.0*(1+z0[i])/((1-z1[j])*(1-z2[k]));
1315  m_fac2[i + j*m_nquad0 + k*m_nquad0*m_nquad1]
1316  = 2.0/(1-z2[k]);
1317  m_fac3[i + j*m_nquad0 + k*m_nquad0*m_nquad1]
1318  = (1+z1[j])/(1-z2[k]);
1319  }
1320  }
1321  }
1322 
1323  }
Operator(std::vector< StdRegions::StdExpansionSharedPtr > pCollExp, boost::shared_ptr< CoalescedGeomData > GeomData)
Constructor.
Definition: Operator.h:112
std::vector< PointsKey > PointsKeyVector
Definition: Points.h:242
StdRegions::StdExpansionSharedPtr m_stdExp
Definition: Operator.h:146
Array< TwoD, const NekDouble > m_derivFac
Definition: PhysDeriv.cpp:1256

Member Function Documentation

virtual void Nektar::Collections::PhysDeriv_SumFac_Tet::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 1085 of file PhysDeriv.cpp.

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

1091  {
1092  int nPhys = m_stdExp->GetTotPoints();
1093  int ntot = m_numElmt*nPhys;
1094  Array<OneD, NekDouble> tmp0,tmp1,tmp2;
1095  Array<OneD, Array<OneD, NekDouble> > Diff(3);
1096  Array<OneD, Array<OneD, NekDouble> > out(3);
1097  out[0] = output0; out[1] = output1; out[2] = output2;
1098 
1099  for(int i = 0; i < m_dim; ++i)
1100  {
1101  Diff[i] = wsp + i*ntot;
1102  }
1103 
1104  // dEta0
1105  Blas::Dgemm('N','N', m_nquad0,m_nquad1*m_nquad2*m_numElmt,
1106  m_nquad0,1.0, m_Deriv0,m_nquad0,&input[0],
1107  m_nquad0,0.0,&Diff[0][0],m_nquad0);
1108 
1109  // dEta2
1110  for(int i = 0; i < m_numElmt; ++i)
1111  {
1112  Blas::Dgemm('N','T',m_nquad0*m_nquad1,m_nquad2,m_nquad2,
1113  1.0, &input[i*nPhys],m_nquad0*m_nquad1,
1114  m_Deriv2,m_nquad2, 0.0,&Diff[2][i*nPhys],
1115  m_nquad0*m_nquad1);
1116  }
1117 
1118  for(int i = 0; i < m_numElmt; ++i)
1119  {
1120 
1121  // dEta1
1122  for (int j = 0; j < m_nquad2; ++j)
1123  {
1124  Blas::Dgemm('N', 'T', m_nquad0, m_nquad1, m_nquad1,
1125  1.0, &input[i*nPhys+j*m_nquad0*m_nquad1],
1126  m_nquad0, m_Deriv1, m_nquad1, 0.0,
1127  &Diff[1][i*nPhys+j*m_nquad0*m_nquad1],
1128  m_nquad0);
1129  }
1130 
1131  // dxi2 = (1 + eta_1)/(1 -eta_2)*dEta1 + dEta2
1132  Vmath::Vvtvp(nPhys, m_fac3.get(), 1,
1133  Diff[1].get() + i*nPhys, 1,
1134  Diff[2].get() + i*nPhys, 1,
1135  Diff[2].get() + i*nPhys, 1);
1136 
1137  // dxi1 = 2/(1 - eta_2) dEta1
1138  Vmath::Vmul(nPhys, m_fac2.get(), 1,
1139  Diff[1].get() + i*nPhys, 1,
1140  Diff[1].get() + i*nPhys, 1);
1141 
1142  // dxi1 = 2.0(1+eta_0)/((1-eta_1)(1-eta_2)) dEta0 + dxi1
1143  Vmath::Vvtvp(nPhys, m_fac1.get(), 1,
1144  Diff[0].get() + i*nPhys, 1,
1145  Diff[1].get() + i*nPhys, 1,
1146  Diff[1].get() + i*nPhys, 1);
1147 
1148  // dxi2 = 2.0(1+eta_0)/((1-eta_1)(1-eta_2)) dEta0 + dxi2
1149  Vmath::Vvtvp(nPhys, m_fac1.get(), 1,
1150  Diff[0].get() + i*nPhys, 1,
1151  Diff[2].get() + i*nPhys, 1,
1152  Diff[2].get() + i*nPhys, 1);
1153 
1154  // dxi0 = 4.0/((1-eta_1)(1-eta_2)) dEta0
1155  Vmath::Vmul(nPhys, m_fac0.get(), 1,
1156  Diff[0].get() + i*nPhys, 1,
1157  Diff[0].get() + i*nPhys, 1);
1158 
1159  }
1160 
1161  // calculate full derivative
1162  for(int i = 0; i < m_coordim; ++i)
1163  {
1164  Vmath::Vmul(ntot,m_derivFac[i*m_dim],1,Diff[0],1,out[i],1);
1165  for(int j = 1; j < m_dim; ++j)
1166  {
1167  Vmath::Vvtvp (ntot, m_derivFac[i*m_dim+j], 1,
1168  Diff[j], 1, out[i], 1, out[i], 1);
1169  }
1170  }
1171  }
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< TwoD, const NekDouble > m_derivFac
Definition: PhysDeriv.cpp:1256
void Vmul(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x*y.
Definition: Vmath.cpp:183
virtual void Nektar::Collections::PhysDeriv_SumFac_Tet::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 1173 of file PhysDeriv.cpp.

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

1178  {
1179  int nPhys = m_stdExp->GetTotPoints();
1180  int ntot = m_numElmt*nPhys;
1181  Array<OneD, NekDouble> tmp0,tmp1,tmp2;
1182  Array<OneD, Array<OneD, NekDouble> > Diff(3);
1183 
1184  for(int i = 0; i < m_dim; ++i)
1185  {
1186  Diff[i] = wsp + i*ntot;
1187  }
1188 
1189  // dEta0
1190  Blas::Dgemm('N','N', m_nquad0,m_nquad1*m_nquad2*m_numElmt,
1191  m_nquad0,1.0, m_Deriv0,m_nquad0,&input[0],
1192  m_nquad0,0.0,&Diff[0][0],m_nquad0);
1193 
1194  // dEta2
1195  for(int i = 0; i < m_numElmt; ++i)
1196  {
1197  Blas::Dgemm('N','T',m_nquad0*m_nquad1,m_nquad2,m_nquad2,
1198  1.0, &input[i*nPhys],m_nquad0*m_nquad1,
1199  m_Deriv2,m_nquad2, 0.0,&Diff[2][i*nPhys],
1200  m_nquad0*m_nquad1);
1201  }
1202 
1203  for(int i = 0; i < m_numElmt; ++i)
1204  {
1205 
1206  // dEta1
1207  for (int j = 0; j < m_nquad2; ++j)
1208  {
1209  Blas::Dgemm('N', 'T', m_nquad0, m_nquad1, m_nquad1,
1210  1.0, &input[i*nPhys+j*m_nquad0*m_nquad1],
1211  m_nquad0, m_Deriv1, m_nquad1, 0.0,
1212  &Diff[1][i*nPhys+j*m_nquad0*m_nquad1],
1213  m_nquad0);
1214  }
1215 
1216  // dxi2 = (1 + eta_1)/(1 -eta_2)*dEta1 + dEta2
1217  Vmath::Vvtvp(nPhys, m_fac3.get(), 1,
1218  Diff[1].get() + i*nPhys, 1,
1219  Diff[2].get() + i*nPhys, 1,
1220  Diff[2].get() + i*nPhys, 1);
1221 
1222  // dxi1 = 2/(1 - eta_2) dEta1
1223  Vmath::Vmul(nPhys, m_fac2.get(), 1,
1224  Diff[1].get() + i*nPhys, 1,
1225  Diff[1].get() + i*nPhys, 1);
1226 
1227  // dxi1 = 2.0(1+eta_0)/((1-eta_1)(1-eta_2)) dEta0 + dxi1
1228  Vmath::Vvtvp(nPhys, m_fac1.get(), 1,
1229  Diff[0].get() + i*nPhys, 1,
1230  Diff[1].get() + i*nPhys, 1,
1231  Diff[1].get() + i*nPhys, 1);
1232 
1233  // dxi2 = 2.0(1+eta_0)/((1-eta_1)(1-eta_2)) dEta0 + dxi2
1234  Vmath::Vvtvp(nPhys, m_fac1.get(), 1,
1235  Diff[0].get() + i*nPhys, 1,
1236  Diff[2].get() + i*nPhys, 1,
1237  Diff[2].get() + i*nPhys, 1);
1238 
1239  // dxi0 = 4.0/((1-eta_1)(1-eta_2)) dEta0
1240  Vmath::Vmul(nPhys, m_fac0.get(), 1,
1241  Diff[0].get() + i*nPhys, 1,
1242  Diff[0].get() + i*nPhys, 1);
1243 
1244  }
1245 
1246  // calculate full derivative
1247  Vmath::Vmul(ntot,m_derivFac[dir*m_dim],1,Diff[0],1,output,1);
1248  for(int j = 1; j < m_dim; ++j)
1249  {
1250  Vmath::Vvtvp (ntot, m_derivFac[dir*m_dim+j], 1,
1251  Diff[j], 1, output, 1, output, 1);
1252  }
1253  }
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< TwoD, const NekDouble > m_derivFac
Definition: PhysDeriv.cpp:1256
void Vmul(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x*y.
Definition: Vmath.cpp:183

Member Data Documentation

int Nektar::Collections::PhysDeriv_SumFac_Tet::m_coordim
protected

Definition at line 1258 of file PhysDeriv.cpp.

NekDouble* Nektar::Collections::PhysDeriv_SumFac_Tet::m_Deriv0
protected

Definition at line 1262 of file PhysDeriv.cpp.

NekDouble* Nektar::Collections::PhysDeriv_SumFac_Tet::m_Deriv1
protected

Definition at line 1263 of file PhysDeriv.cpp.

NekDouble* Nektar::Collections::PhysDeriv_SumFac_Tet::m_Deriv2
protected

Definition at line 1264 of file PhysDeriv.cpp.

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

Definition at line 1256 of file PhysDeriv.cpp.

int Nektar::Collections::PhysDeriv_SumFac_Tet::m_dim
protected

Definition at line 1257 of file PhysDeriv.cpp.

Array<OneD, NekDouble> Nektar::Collections::PhysDeriv_SumFac_Tet::m_fac0
protected

Definition at line 1265 of file PhysDeriv.cpp.

Array<OneD, NekDouble> Nektar::Collections::PhysDeriv_SumFac_Tet::m_fac1
protected

Definition at line 1266 of file PhysDeriv.cpp.

Array<OneD, NekDouble> Nektar::Collections::PhysDeriv_SumFac_Tet::m_fac2
protected

Definition at line 1267 of file PhysDeriv.cpp.

Array<OneD, NekDouble> Nektar::Collections::PhysDeriv_SumFac_Tet::m_fac3
protected

Definition at line 1268 of file PhysDeriv.cpp.

const int Nektar::Collections::PhysDeriv_SumFac_Tet::m_nquad0
protected

Definition at line 1259 of file PhysDeriv.cpp.

const int Nektar::Collections::PhysDeriv_SumFac_Tet::m_nquad1
protected

Definition at line 1260 of file PhysDeriv.cpp.

const int Nektar::Collections::PhysDeriv_SumFac_Tet::m_nquad2
protected

Definition at line 1261 of file PhysDeriv.cpp.