Nektar++
StdExpansion0D.cpp
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File StdExpansion0D.cpp
4 //
5 // For more information, please see: http://www.nektar.info
6 //
7 // The MIT License
8 //
9 // Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10 // Department of Aeronautics, Imperial College London (UK), and Scientific
11 // Computing and Imaging Institute, University of Utah (USA).
12 //
13 // License for the specific language governing rights and limitations under
14 // Permission is hereby granted, free of charge, to any person obtaining a
15 // copy of this software and associated documentation files (the "Software"),
16 // to deal in the Software without restriction, including without limitation
17 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
18 // and/or sell copies of the Software, and to permit persons to whom the
19 // Software is furnished to do so, subject to the following conditions:
20 //
21 // The above copyright notice and this permission notice shall be included
22 // in all copies or substantial portions of the Software.
23 //
24 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
27 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
30 // DEALINGS IN THE SOFTWARE.
31 //
32 // Description: Daughter of StdExpansion. This class contains routine
33 // which are common to 0d expansion. Typically this inolves physiocal
34 // space operations.
35 //
36 ///////////////////////////////////////////////////////////////////////////////
37 
39 
40 namespace Nektar
41 {
42  namespace StdRegions
43  {
44 
46  {
47  }
48 
50  StdExpansion(numcoeffs,1,Ba)
51  {
52  }
53 
55  {
56  }
57 
59  {
60  }
61 
62 
63  //----------------------------
64  // Differentiation Methods
65  //-----------------------------
66 
68  Array<OneD, NekDouble>& outarray)
69  {
70  int nquad = GetTotPoints();
71  DNekMatSharedPtr D = m_base[0]->GetD();
72 
73 #ifdef NEKTAR_USING_DIRECT_BLAS_CALLS
74 
75  if( inarray.data() == outarray.data())
76  {
77  Array<OneD, NekDouble> wsp(nquad);
78  CopyArray(inarray, wsp);
79  Blas::Dgemv('N',nquad,nquad,1.0,&(D->GetPtr())[0],nquad,
80  &wsp[0],1,0.0,&outarray[0],1);
81  }
82  else
83  {
84  Blas::Dgemv('N',nquad,nquad,1.0,&(D->GetPtr())[0],nquad,
85  &inarray[0],1,0.0,&outarray[0],1);
86  }
87 
88 #else //NEKTAR_USING_DIRECT_BLAS_CALLS
89 
90  NekVector<NekDouble> out(nquad,outarray,eWrapper);
91 
92  if(inarray.data() == outarray.data()) // copy intput array
93  {
94  NekVector<NekDouble> in(nquad,inarray,eCopy);
95  out = (*D)*in;
96  }
97  else
98  {
99  NekVector<NekDouble> in (nquad,inarray,eWrapper);
100  out = (*D)*in;
101  }
102 
103 #endif //NEKTAR_USING_DIRECT_BLAS_CALLS
104  }
105 
107  {
108  int nquad = GetTotPoints();
109  NekDouble val;
110  DNekMatSharedPtr I = m_base[0]->GetI(Lcoord);
111 
112  ASSERTL2(Lcoord[0] >= -1,"Lcoord[0] < -1");
113  ASSERTL2(Lcoord[0] <= 1,"Lcoord[0] > 1");
114 
115  val = Blas::Ddot(nquad, I->GetPtr(), 1, physvals, 1);
116 
117  return val;
118  }
119 
120  }//end namespace
121 }//end namespace
122 
123 /**
124  * $Log: StdExpansion0D.cpp,v $
125  * Revision 1.1 2011/11/16 09:14:57 croth
126  *
127  * created class
128  *
129  **/
130 
boost::shared_ptr< DNekMat > DNekMatSharedPtr
Definition: NekTypeDefs.hpp:70
void PhysTensorDeriv(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
int GetTotPoints() const
This function returns the total number of quadrature points used in the element.
Definition: StdExpansion.h:141
virtual NekDouble v_PhysEvaluate(const Array< OneD, const NekDouble > &coords, const Array< OneD, const NekDouble > &physvals)
The base class for all shapes.
Definition: StdExpansion.h:69
double NekDouble
void CopyArray(const Array< OneD, ConstDataType > &source, Array< OneD, DataType > &dest)
T Ddot(int n, const Array< OneD, const T > &w, const int incw, const Array< OneD, const T > &x, const int incx, const Array< OneD, const int > &y, const int incy)
Definition: VmathArray.hpp:434
#define ASSERTL2(condition, msg)
Assert Level 2 – Debugging which is used FULLDEBUG compilation mode. This level assert is designed t...
Definition: ErrorUtil.hpp:213
Array< OneD, LibUtilities::BasisSharedPtr > m_base
Describes the specification for a Basis.
Definition: Basis.h:50