From cd5ba8b8acd013844bcc508a564aeb408b630474 Mon Sep 17 00:00:00 2001 From: Dmitri Naumov <dmitri.naumov@ufz.de> Date: Mon, 14 Sep 2015 16:18:50 +0200 Subject: [PATCH] [NL] Add shape matrices for point elements. --- NumLib/Fem/ShapeFunction/ShapePoint1-impl.h | 19 +++++++++++ NumLib/Fem/ShapeFunction/ShapePoint1.h | 36 +++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 NumLib/Fem/ShapeFunction/ShapePoint1-impl.h create mode 100644 NumLib/Fem/ShapeFunction/ShapePoint1.h diff --git a/NumLib/Fem/ShapeFunction/ShapePoint1-impl.h b/NumLib/Fem/ShapeFunction/ShapePoint1-impl.h new file mode 100644 index 00000000000..81907f2162d --- /dev/null +++ b/NumLib/Fem/ShapeFunction/ShapePoint1-impl.h @@ -0,0 +1,19 @@ +/** + * \copyright + * Copyright (c) 2012-2015, OpenGeoSys Community (http://www.opengeosys.org) + * Distributed under a Modified BSD License. + * See accompanying file LICENSE.txt or + * http://www.opengeosys.org/project/license + * + */ + +namespace NumLib +{ + +template <class T_X, class T_N> +void ShapePoint1::computeShapeFunction(const T_X& /*r*/, T_N& N) +{ + N[0] = 1; +} + +} diff --git a/NumLib/Fem/ShapeFunction/ShapePoint1.h b/NumLib/Fem/ShapeFunction/ShapePoint1.h new file mode 100644 index 00000000000..8ce677719c8 --- /dev/null +++ b/NumLib/Fem/ShapeFunction/ShapePoint1.h @@ -0,0 +1,36 @@ +/** + * \copyright + * Copyright (c) 2012-2015, OpenGeoSys Community (http://www.opengeosys.org) + * Distributed under a Modified BSD License. + * See accompanying file LICENSE.txt or + * http://www.opengeosys.org/project/license + * + */ + +#ifndef SHAPEPOINT1_H_ +#define SHAPEPOINT1_H_ + +#include "MeshLib/Elements/Point.h" + +namespace NumLib +{ +/// Shape function for a point element in natural coordinates. +class ShapePoint1 +{ +public: + /// Evaluate the shape function at the given point + /// + /// @param [in] r point coordinates + /// @param [out] N a vector of calculated shape function. + template <class T_X, class T_N> + static void computeShapeFunction(const T_X& r, T_N& N); + + using MeshElement = MeshLib::Point; + static const std::size_t DIM = MeshElement::dimension; + static const std::size_t NPOINTS = MeshElement::n_all_nodes; +}; +} + +#include "ShapePoint1-impl.h" + +#endif // SHAPEPOINT1_H_ -- GitLab