[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Getfem-commits] r4606 - in /trunk/getfem: doc/sphinx/source/userdoc/gas
From: |
Yves . Renard |
Subject: |
[Getfem-commits] r4606 - in /trunk/getfem: doc/sphinx/source/userdoc/gasm_high.rst src/getfem_generic_assembly.cc |
Date: |
Sun, 13 Apr 2014 08:18:07 -0000 |
Author: renard
Date: Sun Apr 13 10:18:06 2014
New Revision: 4606
URL: http://svn.gna.org/viewcvs/getfem?rev=4606&view=rev
Log:
adding cardinal sine function
Modified:
trunk/getfem/doc/sphinx/source/userdoc/gasm_high.rst
trunk/getfem/src/getfem_generic_assembly.cc
Modified: trunk/getfem/doc/sphinx/source/userdoc/gasm_high.rst
URL:
http://svn.gna.org/viewcvs/getfem/trunk/getfem/doc/sphinx/source/userdoc/gasm_high.rst?rev=4606&r1=4605&r2=4606&view=diff
==============================================================================
--- trunk/getfem/doc/sphinx/source/userdoc/gasm_high.rst (original)
+++ trunk/getfem/doc/sphinx/source/userdoc/gasm_high.rst Sun Apr 13
10:18:06 2014
@@ -364,7 +364,7 @@
The constants or data
*********************
-A list of constants could also be given to the ``ga_worspace`` object. The
rule are the same as for the variables but no test function can be associated
to constants and there is no symbolic differentiation with respect to
constants. Scalar constants are often defined to represent the coefficients
which intervene in constitutive laws. Additionally, constants can be some
scalar/vector/tensor fields defined on integration points via a ``im_data`
object (for instance for some implementation of the approximation of
consttutive laws such as plasticity).
+A list of constants could also be given to the ``ga_worspace`` object. The
rule are the same as for the variables but no test function can be associated
to constants and there is no symbolic differentiation with respect to
constants. Scalar constants are often defined to represent the coefficients
which intervene in constitutive laws. Additionally, constants can be some
scalar/vector/tensor fields defined on integration points via a ``im_data``
object (for instance for some implementation of the approximation of
constitutive laws such as plasticity).
Test functions
@@ -398,6 +398,7 @@
- ``sinh(t)``, ``cosh(t)``, ``tanh(t)``, ``asinh(t)``, ``acosh(t)``,
``atanh(t)``
- ``erf(t)``, ``erfc(t)``
+ - ``sinc(t)`` (the cardinal sine function sin(t)/t)
- ``Heaviside(t)`` (:math:`0 \mbox{ for } t < 0, 1 \mbox{ for } t \ge 0`),
``sign(t)``, ``abs(t)``, ``pos_part(t)`` (:math:`t*H(t)`),
Modified: trunk/getfem/src/getfem_generic_assembly.cc
URL:
http://svn.gna.org/viewcvs/getfem/trunk/getfem/src/getfem_generic_assembly.cc?rev=4606&r1=4605&r2=4606&view=diff
==============================================================================
--- trunk/getfem/src/getfem_generic_assembly.cc (original)
+++ trunk/getfem/src/getfem_generic_assembly.cc Sun Apr 13 10:18:06 2014
@@ -1347,7 +1347,14 @@
static scalar_type ga_neg_part(scalar_type t) { return (t >= 0.) ? 0. : -t; }
static scalar_type ga_half_sqr_neg_part(scalar_type t)
{ return (t >= 0.) ? 0. : 0.5*t*t; }
-
+ static scalar_type ga_sinc(scalar_type t) {// cardinal sine function sin(t)/t
+ if (gmm::abs(t) < 1E-5) {
+ scalar_type t2 = t*t;
+ return 1-t2/6.+ t2*t2/120.;
+ } else {
+ return sin(t)/t;
+ }
+ }
static scalar_type ga_sqr(scalar_type t) { return t*t; }
static scalar_type ga_max(scalar_type t, scalar_type u)
{ return std::max(t,u); }
@@ -1357,6 +1364,22 @@
static scalar_type ga_sign(scalar_type t) { return (t >= 0.) ? 1.: -1.; }
// Derivatives of predefined functions
+ static scalar_type ga_der_sinc(scalar_type t) {
+ if (gmm::abs(t) < 1E-5) {
+ scalar_type t2 = t*t;
+ return -t/3. + t*t2/30. -t*t2*t2/840.;
+ } else {
+ return (t*cos(t) - sin(t))/(t*t);
+ }
+ }
+ static scalar_type ga_der2_sinc(scalar_type t) {
+ if (gmm::abs(t) < 1E-5) {
+ scalar_type t2 = t*t;
+ return -1./3. + t2/10. -t2*t2/168.;
+ } else {
+ return ((2. - t*t)*sin(t) - 2.*t*cos(t))/(t*t*t);
+ }
+ }
static scalar_type ga_der_sqrt(scalar_type t) { return 0.5/sqrt(t); }
// static scalar_type ga_der_sqr(scalar_type t) { return 2*t; }
static scalar_type ga_der_pow1(scalar_type t, scalar_type u)
@@ -1653,7 +1676,13 @@
PREDEF_FUNCTIONS["asin"] = ga_predef_function(asin, 1, "DER_PDFUNC_ASIN");
PREDEF_FUNCTIONS["acos"] = ga_predef_function(acos, 1, "DER_PDFUNC_ACOS");
PREDEF_FUNCTIONS["atan"] = ga_predef_function(atan, 1, "DER_PDFUNC_ATAN");
+ PREDEF_FUNCTIONS["sinc"] = ga_predef_function(ga_sinc, 1,
+ "DER_PDFUNC_SINC");
+ PREDEF_FUNCTIONS["DER_PDFUNC_SINC"] = ga_predef_function(ga_der_sinc,
+ 1, "DER2_PDFUNC_SINC");
+ PREDEF_FUNCTIONS["DER2_PDFUNC_SINC"] = ga_predef_function(ga_der2_sinc);
+
PREDEF_FUNCTIONS["DER_PDFUNC_COS"] =
ga_predef_function(ga_der_cos, 2, "-cos(t)");
PREDEF_FUNCTIONS["DER_PDFUNC_TAN"] =
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Getfem-commits] r4606 - in /trunk/getfem: doc/sphinx/source/userdoc/gasm_high.rst src/getfem_generic_assembly.cc,
Yves . Renard <=