Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
StdExpansion1D.cpp
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File StdExpansion1D.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 1d 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  const Array<OneD, const NekDouble>& Lcoord,
108  const Array<OneD, const NekDouble>& physvals)
109  {
110  int nquad = GetTotPoints();
111  NekDouble val;
112  DNekMatSharedPtr I = m_base[0]->GetI(Lcoord);
113 
114  ASSERTL2(Lcoord[0] >= -1,"Lcoord[0] < -1");
115  ASSERTL2(Lcoord[0] <= 1,"Lcoord[0] > 1");
116 
117  val = Blas::Ddot(nquad, I->GetPtr(), 1, physvals, 1);
118 
119  return val;
120  }
121 
122  void StdExpansion1D::v_SetUpPhysNormals(const int vertex)
123  {
124  ComputeVertexNormal(vertex);
125  }
126 
128  {
129  return v_GetVertexNormal(id);
130  }
131 
132 
133  const NormalVector & StdExpansion1D::v_GetVertexNormal(const int vertex) const
134  {
135  std::map<int, NormalVector>::const_iterator x;
136  x = m_vertexNormals.find(vertex);
137  ASSERTL0 (x != m_vertexNormals.end(),
138  "vertex normal not computed.");
139  return x->second;
140  }
141 
142  }//end namespace
143 }//end namespace
144 
145 /**
146  * $Log: StdExpansion1D.cpp,v $
147  * Revision 1.28 2008/08/20 09:14:57 sherwin
148  * In TensorDeriv replaced comparison of arrays with comparison of stored pointer
149  *
150  * Revision 1.27 2008/08/18 08:31:26 sherwin
151  * Update to fix PhysTensorDeriv when inarray == outarray
152  *
153  * Revision 1.26 2008/07/04 10:18:40 pvos
154  * Some updates
155  *
156  * Revision 1.25 2008/05/07 16:04:57 pvos
157  * Mapping + Manager updates
158  *
159  * Revision 1.24 2008/04/06 06:04:14 bnelson
160  * Changed ConstArray to Array<const>
161  *
162  * Revision 1.23 2008/04/03 16:12:11 pvos
163  * updates for NEKTAR_USING_DIRECT_BLAS_CALLS
164  *
165  * Revision 1.22 2008/03/12 15:25:09 pvos
166  * Clean up of the code
167  *
168  * Revision 1.21 2007/11/29 21:40:22 sherwin
169  * updates for MultiRegions and DG solver
170  *
171  * Revision 1.20 2007/11/08 14:23:33 ehan
172  * Removed white space
173  *
174  * Revision 1.19 2007/07/20 02:16:53 bnelson
175  * Replaced boost::shared_ptr with Nektar::ptr
176  *
177  * Revision 1.18 2007/05/28 08:35:26 sherwin
178  * Updated for localregions up to Project1D
179  *
180  * Revision 1.17 2007/05/17 17:59:28 sherwin
181  * Modification to make Demos work after introducion of Array<>
182  *
183  * Revision 1.16 2007/05/15 05:18:22 bnelson
184  * Updated to use the new Array object.
185  *
186  * Revision 1.15 2007/04/26 15:00:17 sherwin
187  * SJS compiling working version using SHaredArrays
188  *
189  * Revision 1.14 2007/04/10 14:00:45 sherwin
190  * Update to include SharedArray in all 2D element (including Nodal tris). Have also remvoed all new and double from 2D shapes in StdRegions
191  *
192  * Revision 1.13 2007/04/08 03:36:58 jfrazier
193  * Updated to use SharedArray consistently and minor reformatting.
194  *
195  * Revision 1.12 2007/04/04 20:48:17 sherwin
196  * Update to handle SharedArrays
197  *
198  * Revision 1.11 2007/03/29 19:35:09 bnelson
199  * Replaced boost::shared_array with SharedArray
200  *
201  * Revision 1.10 2007/03/20 16:58:42 sherwin
202  * Update to use Array<OneD, NekDouble> storage and NekDouble usage, compiling and executing up to Demos/StdRegions/Project1D
203  *
204  * Revision 1.9 2007/03/14 21:24:09 sherwin
205  * Update for working version of MultiRegions up to ExpList1D
206  *
207  * Revision 1.8 2007/02/07 12:51:53 sherwin
208  * Compiling version of Project1D
209  *
210  * Revision 1.7 2007/01/30 20:01:35 sherwin
211  * Update for first compiling Project1D routine
212  *
213  * Revision 1.6 2007/01/28 18:34:22 sherwin
214  * More modifications to make Demo Project1D compile
215  *
216  * Revision 1.5 2007/01/21 02:28:08 sherwin
217  * Compiling under new revision
218  *
219  * Revision 1.4 2007/01/20 22:35:21 sherwin
220  * Version with StdExpansion compiling
221  *
222  * Revision 1.3 2007/01/15 11:30:20 pvos
223  * Updating doxygen documentation
224  *
225  * Revision 1.2 2006/06/01 14:46:16 kirby
226  * *** empty log message ***
227  *
228  * Revision 1.1 2006/05/04 18:58:30 kirby
229  * *** empty log message ***
230  *
231  * Revision 1.15 2006/04/01 21:59:27 sherwin
232  * Sorted new definition of ASSERT
233  *
234  * Revision 1.14 2006/03/21 09:21:32 sherwin
235  * Introduced NekMemoryManager
236  *
237  * Revision 1.13 2006/03/13 18:29:35 sherwin
238  *
239  * Corrected error with definition of GetCoords
240  *
241  * Revision 1.12 2006/02/27 23:47:23 sherwin
242  *
243  * Standard coding update upto compilation of StdHexExp.cpp
244  *
245  * Revision 1.11 2006/02/26 23:37:29 sherwin
246  *
247  * Updates and compiling checks upto StdExpansions1D
248  *
249  **/
250 
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:188
std::map< int, NormalVector > m_vertexNormals
boost::shared_ptr< DNekMat > DNekMatSharedPtr
Definition: NekTypeDefs.hpp:70
int GetTotPoints() const
This function returns the total number of quadrature points used in the element.
Definition: StdExpansion.h:141
const NormalVector & v_GetVertexNormal(const int vertex) const
The base class for all shapes.
Definition: StdExpansion.h:69
void ComputeVertexNormal(const int vertex)
double NekDouble
const NormalVector & v_GetSurfaceNormal(const int id) const
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
void PhysTensorDeriv(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Evaluate the derivative at the physical quadrature points given by inarray and return in outarray...
#define ASSERTL2(condition, msg)
Assert Level 2 – Debugging which is used FULLDEBUG compilation mode. This level assert is designed t...
Definition: ErrorUtil.hpp:240
virtual void v_SetUpPhysNormals(const int vertex)
Array< OneD, LibUtilities::BasisSharedPtr > m_base
Describes the specification for a Basis.
Definition: Basis.h:50
virtual NekDouble v_PhysEvaluate(const Array< OneD, const NekDouble > &coords, const Array< OneD, const NekDouble > &physvals)