SCIRun  5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CrvElementWeights.h
Go to the documentation of this file.
1 //
2 // For more information, please see: http://software.sci.utah.edu
3 //
4 // The MIT License
5 //
6 // Copyright (c) 2009 Scientific Computing and Imaging Institute,
7 // University of Utah.
8 //
9 //
10 // Permission is hereby granted, free of charge, to any person obtaining a
11 // copy of this software and associated documentation files (the "Software"),
12 // to deal in the Software without restriction, including without limitation
13 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
14 // and/or sell copies of the Software, and to permit persons to whom the
15 // Software is furnished to do so, subject to the following conditions:
16 //
17 // The above copyright notice and this permission notice shall be included
18 // in all copies or substantial portions of the Software.
19 //
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26 // DEALINGS IN THE SOFTWARE.
27 
28 
29 #ifndef CORE_BASIS_CRVWEIGHTS_H
30 #define CORE_BASIS_CRVWEIGHTS_H 1
31 
32 #include <Core/Basis/share.h>
33 
34 namespace SCIRun {
35 namespace Core {
36 namespace Basis {
37 
39 
40 public:
41  template <class VECTOR>
42  void get_linear_weights(const VECTOR& coords, double *w) const
43  {
44  const double x = static_cast<double>(coords[0]);
45  w[0] = 1. - x;
46  w[1] = x;
47  }
48 
49  /// get derivative weight factors at parametric coordinate
50  template <class VECTOR>
51  void get_linear_derivate_weights(const VECTOR& /*coords*/, double *w) const
52  {
53  w[0] = -1.0;
54  w[1] = 1.0;
55  }
56 
57  /// get weight factors at parametric coordinate
58  template< class VECTOR>
59  void get_quadratic_weights(const VECTOR& coords, double *w) const
60  {
61  const double x = static_cast<double>(coords[0]);
62  w[0] = 1 - 3*x + 2*x*x;
63  w[1] = x*(-1 + 2*x);
64  w[2] = -4*(-1 + x)*x;
65  }
66 
67  /// get weight factors of derivative at parametric coordinate
68  template< class VECTOR>
69  void get_quadratic_derivate_weights(const VECTOR& coords, double *w) const
70  {
71  const double x = static_cast<double>(coords[0]);
72  w[0] = (-3 + 4*x);
73  w[1] = (-1 + 4*x);
74  w[2] = (4 - 8*x);
75  }
76 
77  template <class VECTOR>
78  void get_cubic_weights(const VECTOR &coords, double *w) const
79  {
80  const double x = static_cast<double>(coords[0]);
81  w[0] = (x-1)*(x-1)*(1 + 2*x);
82  w[1] = (x-1)*(x-1)*x;
83  w[2] = (3 - 2*x)*x*x;
84  w[3] = (-1+x)*x*x;
85  }
86 
87  /// get derivative weight factors at parametric coordinate
88  template <class VECTOR>
89  void get_cubic_derivate_weights(const VECTOR &coords, double *w) const
90  {
91  const double x = static_cast<double>(coords[0]);
92  w[0] = 6*(-1 + x)*x;
93  w[1] = (1 - 4*x + 3*x*x);
94  w[2] = -6*(-1 + x)*x;
95  w[3] = x*(-2 + 3*x);
96  }
97 
98  inline int num_linear_weights() { return 2; }
99  inline int num_quadratic_weights() { return 3; }
100  inline int num_cubic_weights() { return 4; }
101 
102  inline int num_linear_derivate_weights() { return 2; }
103  inline int num_quadratic_derivate_weights() { return 3; }
104  inline int num_cubic_derivate_weights() { return 4; }
105 
106  inline int num_derivs() { return 1; }
107  inline int num_hderivs() { return 1; }
108 };
109 
110 }}}
111 
112 #endif
void get_linear_derivate_weights(const VECTOR &, double *w) const
get derivative weight factors at parametric coordinate
Definition: CrvElementWeights.h:51
Definition: CrvElementWeights.h:38
int num_hderivs()
Definition: CrvElementWeights.h:107
int num_quadratic_weights()
Definition: CrvElementWeights.h:99
int num_cubic_derivate_weights()
Definition: CrvElementWeights.h:104
#define SCISHARE
Definition: share.h:39
void get_cubic_weights(const VECTOR &coords, double *w) const
Definition: CrvElementWeights.h:78
void get_quadratic_derivate_weights(const VECTOR &coords, double *w) const
get weight factors of derivative at parametric coordinate
Definition: CrvElementWeights.h:69
int num_quadratic_derivate_weights()
Definition: CrvElementWeights.h:103
int num_linear_derivate_weights()
Definition: CrvElementWeights.h:102
int num_cubic_weights()
Definition: CrvElementWeights.h:100
int num_linear_weights()
Definition: CrvElementWeights.h:98
void get_quadratic_weights(const VECTOR &coords, double *w) const
get weight factors at parametric coordinate
Definition: CrvElementWeights.h:59
void get_linear_weights(const VECTOR &coords, double *w) const
Definition: CrvElementWeights.h:42
void get_cubic_derivate_weights(const VECTOR &coords, double *w) const
get derivative weight factors at parametric coordinate
Definition: CrvElementWeights.h:89
int num_derivs()
Definition: CrvElementWeights.h:106