From 299cddb57c69c169b3f24e7d83b4bda941ce83cf Mon Sep 17 00:00:00 2001 From: Nicolas Marsic <nicolas.marsic@gmail.com> Date: Fri, 15 Jun 2012 10:14:26 +0000 Subject: [PATCH] --- FunctionSpace/LocalFunctionSpace.cpp | 24 +++++++++++++++ FunctionSpace/LocalFunctionSpace.h | 34 ++++++++++++++++++++-- FunctionSpace/LocalFunctionSpaceScalar.cpp | 19 ++++++++++++ 3 files changed, 74 insertions(+), 3 deletions(-) diff --git a/FunctionSpace/LocalFunctionSpace.cpp b/FunctionSpace/LocalFunctionSpace.cpp index 8849f7e537..d928b1ba67 100644 --- a/FunctionSpace/LocalFunctionSpace.cpp +++ b/FunctionSpace/LocalFunctionSpace.cpp @@ -1,4 +1,5 @@ #include "LocalFunctionSpace.h" +#include "Exception.h" LocalFunctionSpace::LocalFunctionSpace(void){ @@ -8,3 +9,26 @@ LocalFunctionSpace::~LocalFunctionSpace(void){ } +void LocalFunctionSpace::selectTransform(int form){ + switch(form){ + case 0: + transform = jac::map; + break; + + case 1: + transform = jac::grad; + break; + + case 2: + throw Exception("Mapping of 2-form not implemented"); + break; + + case 3: + throw Exception("Mapping of 3-form not implemented"); + break; + + default: + throw Exception ("Unknow %d-form", from); + break; + } +} diff --git a/FunctionSpace/LocalFunctionSpace.h b/FunctionSpace/LocalFunctionSpace.h index 40418ec598..dce88faa1c 100644 --- a/FunctionSpace/LocalFunctionSpace.h +++ b/FunctionSpace/LocalFunctionSpace.h @@ -8,13 +8,24 @@ This class is the @em mother (by @em inheritence) of all@n Local Function Spaces.@n - A Local Function Space is a Basis on which we can interpolate on. + A Local Function Space is a Basis on which we can interpolate on.@n + In order to interpolate, a Local Function Space shall colaborate + with a Jacobian. */ +#include "Jacobian.h" + class LocalFunctionSpace{ protected: - bool scalar; - int size; + typedef fullVector<double>(Jacobian::*JacMethod) + (const fullVector<double>&) const; + + bool scalar; + int size; + int type; + + Jacobian* jac; + JacMethod transform; public: //! Deletes this LocalFunctionSpace @@ -33,10 +44,24 @@ class LocalFunctionSpace{ //! @return Returns the size of the Basis used int getSize(void) const; + //! @return Returns the type of the Basis used + //! @li 0 for 0-form + //! @li 1 for 1-form + //! @li 2 for 2-form + //! @li 3 for 3-form + //! @todo Check if the 'form numbering' is good + int getType(void) const; + protected: //! Instantiate a new LocalFunctionSpace //! @warning Users can't instantiate a LocalFunctionSpace LocalFunctionSpace(void); + + //! Selects the right transorm method for the Jacobian + //! @param form The @em type of the Basis used + void selectTransform(int form); + + }; ////////////////////// @@ -51,4 +76,7 @@ inline int LocalFunctionSpace::getSize(void) const{ return size; } +inline int LocalFunctionSpace::getType(void) const{ + return type; +} #endif diff --git a/FunctionSpace/LocalFunctionSpaceScalar.cpp b/FunctionSpace/LocalFunctionSpaceScalar.cpp index 2e6598e2ff..002980f246 100644 --- a/FunctionSpace/LocalFunctionSpaceScalar.cpp +++ b/FunctionSpace/LocalFunctionSpaceScalar.cpp @@ -18,3 +18,22 @@ LocalFunctionSpaceScalar::~LocalFunctionSpaceScalar(void){ // for deleting 'basis' // It's the Basis job } + +double LocalFunctionSpaceScalar::interpolate +(const fullVector<double>& coef, + double x, double y, double z) const{ + + if(coef.size() > size) + throw Exception("To many coeficients for interpolation"); + + if(coef.size() < size) + throw Exception("Not enough coeficients for interpolation"); + + double res = 0; + + for(int i = 0; i < size; ++i){ + + } + + return res; +} -- GitLab