DOLFIN
DOLFIN C++ interface
SpecialFunctions.h
1 // Copyright (C) 2006-2011 Anders Logg
2 //
3 // This file is part of DOLFIN.
4 //
5 // DOLFIN is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU Lesser General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // DOLFIN is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
17 //
18 // Modified by Kristian B. Oelgaard 2007
19 // Modified by Martin Sandve Alnes 2008
20 // Modified by Garth N. Wells 2008
21 //
22 // First added: 2006-02-09
23 // Last changed: 2011-11-16
24 
25 #ifndef __SPECIAL_FUNCTIONS_H
26 #define __SPECIAL_FUNCTIONS_H
27 
28 #include <memory>
29 #include <dolfin/log/Event.h>
30 #include <dolfin/common/Array.h>
31 #include "Expression.h"
32 
33 namespace dolfin
34 {
35 
36  class Mesh;
37 
39  class MeshCoordinates : public Expression
40  {
41  public:
42 
44  explicit MeshCoordinates(std::shared_ptr<const Mesh> mesh);
45 
47  void eval(Array<double>& values, const Array<double>& x,
48  const ufc::cell& cell) const;
49 
50  private:
51 
52  // The mesh
53  std::shared_ptr<const Mesh> _mesh;
54 
55  };
56 
59  class FacetArea : public Expression
60  {
61  public:
62 
64  explicit FacetArea(std::shared_ptr<const Mesh> mesh);
65 
67  void eval(Array<double>& values,
68  const Array<double>& x,
69  const ufc::cell& cell) const;
70 
71  private:
72 
73  // The mesh
74  std::shared_ptr<const Mesh> _mesh;
75 
76  // Warning when evaluating on cells
77  mutable Event not_on_boundary;
78 
79  };
80 
81 }
82 
83 #endif
void eval(Array< double > &values, const Array< double > &x, const ufc::cell &cell) const
Evaluate function.
Definition: SpecialFunctions.cpp:39
This Function represents the mesh coordinates on a given mesh.
Definition: SpecialFunctions.h:39
Definition: Event.h:46
Definition: adapt.h:29
Definition: Array.h:41
Definition: Expression.h:49
MeshCoordinates(std::shared_ptr< const Mesh > mesh)
Constructor.
Definition: SpecialFunctions.cpp:33
Definition: SpecialFunctions.h:59