From 28b722b722205455854320ae13c54b7eb4d486e9 Mon Sep 17 00:00:00 2001 From: Nicolas Marsic <nicolas.marsic@gmail.com> Date: Fri, 15 Jun 2012 13:50:41 +0000 Subject: [PATCH] Auto mapping part 1 --- FunctionSpace/LocalFunctionSpace.cpp | 6 ++-- FunctionSpace/LocalFunctionSpace.h | 39 ++++++++++++++++++++-- FunctionSpace/LocalFunctionSpaceScalar.cpp | 3 ++ 3 files changed, 43 insertions(+), 5 deletions(-) diff --git a/FunctionSpace/LocalFunctionSpace.cpp b/FunctionSpace/LocalFunctionSpace.cpp index d928b1ba67..014ffc4b76 100644 --- a/FunctionSpace/LocalFunctionSpace.cpp +++ b/FunctionSpace/LocalFunctionSpace.cpp @@ -12,11 +12,11 @@ LocalFunctionSpace::~LocalFunctionSpace(void){ void LocalFunctionSpace::selectTransform(int form){ switch(form){ case 0: - transform = jac::map; + transform = LocalFunctionSpace::form0; break; case 1: - transform = jac::grad; + transform = LocalFunctionSpace::form1; break; case 2: @@ -28,7 +28,7 @@ void LocalFunctionSpace::selectTransform(int form){ break; default: - throw Exception ("Unknow %d-form", from); + throw Exception ("Unknow %d-form", form); break; } } diff --git a/FunctionSpace/LocalFunctionSpace.h b/FunctionSpace/LocalFunctionSpace.h index dce88faa1c..38b6fc0495 100644 --- a/FunctionSpace/LocalFunctionSpace.h +++ b/FunctionSpace/LocalFunctionSpace.h @@ -25,7 +25,10 @@ class LocalFunctionSpace{ int type; Jacobian* jac; - JacMethod transform; + fullVector<double> (*transform)(const Jacobian&, + double, + double, + double); public: //! Deletes this LocalFunctionSpace @@ -61,7 +64,24 @@ class LocalFunctionSpace{ //! @param form The @em type of the Basis used void selectTransform(int form); - + //! Mapping of 0-form + //! @param jac The Jacobian to use + //! @param u,v,w The @em reference coordinate to map + //! @return Returns The mapped coordinate in the @em physical space + static fullVector<double> form0(const Jacobian& jac, + double u, + double v, + double w); + + //! Mapping of 1-form + //! @param jac The Jacobian to use + //! @param u,v,w The @em reference coordinate to map + //! @return Returns The mapped coordinate in the @em physical space + static fullVector<double> form1(const Jacobian& jac, + double u, + double v, + double w); + }; ////////////////////// @@ -79,4 +99,19 @@ inline int LocalFunctionSpace::getSize(void) const{ inline int LocalFunctionSpace::getType(void) const{ return type; } + +inline fullVector<double> LocalFunctionSpace::form0(const Jacobian& jac, + double u, + double v, + double w){ + return jac.map(u, v); +} + +inline fullVector<double> LocalFunctionSpace::form1(const Jacobian& jac, + double u, + double v, + double w){ + return jac.grad(u, v); +} + #endif diff --git a/FunctionSpace/LocalFunctionSpaceScalar.cpp b/FunctionSpace/LocalFunctionSpaceScalar.cpp index 002980f246..873ac6136e 100644 --- a/FunctionSpace/LocalFunctionSpaceScalar.cpp +++ b/FunctionSpace/LocalFunctionSpaceScalar.cpp @@ -10,7 +10,10 @@ LocalFunctionSpaceScalar::LocalFunctionSpaceScalar(const Basis& basis){ this->scalar = true; this->size = b.getSize(); + this->type = b.getType(); this->basis = &(b.getBasis()); + + selectTransform(type); } LocalFunctionSpaceScalar::~LocalFunctionSpaceScalar(void){ -- GitLab