Header file inclusion cleanup. Please avoid including 3rd party headers in our header files to avoid uneccesary dependencies. Rely on class forwarding instead.

git-svn-id: http://svn.sintef.no/trondheim/IFEM/trunk@1014 e10b68d5-8a6e-419e-a041-bce267b0401d
This commit is contained in:
kmo 2011-05-26 14:43:17 +00:00 committed by Knut Morten Okstad
parent 1e4050c8be
commit ca4b4899b5
10 changed files with 249 additions and 345 deletions

View File

@ -1,3 +1,4 @@
// $Id$
//==============================================================================
//!
//! \file SplineField.h
@ -6,98 +7,91 @@
//!
//! \author Runar Holdahl / SINTEF
//!
//! \brief Base class for spline based finite element field
//! \brief Base class for spline-based finite element scalar fields.
//!
//==============================================================================
#ifndef _SPLINE_FIELD_H
#define _SPLINE_FIELD_H
#include "Vec3.h"
#include "MatVec.h"
#include "FiniteElement.h"
/*
\brief Base class for spline-based finite element fields.
class FiniteElement;
class Vec3;
\details This class incapsulates the data and methods needed
to store and evaluate a spline finite element scalar field.
This is an abstract base class and the fields associated with
specific spline objects are implemented as subclasses, for
instance 1D, 2D and 3D spline formulations.
/*!
\brief Base class for spline-based finite element scalar fields.
\details This class incapsulates the data and methods needed
to store and evaluate a spline finite element scalar field.
This is an abstract base class and the fields associated with
specific spline objects are implemented as subclasses,
for instance 1D, 2D and 3D spline formulations.
*/
class SplineField
{
protected:
protected:
//! \brief The constructor sets the number of space dimensions and fields.
//! \param[in] nsd Number of space dimensions (1, 2 or 3)
//! \param[in] n Number of space dimensions (1, 2 or 3)
//! \param[in] name Name of spline field
SplineField(unsigned char nsd_, char* name = NULL)
: fieldname(name) {}
SplineField(unsigned char n, char* name = NULL) : nsd(n), fieldname(name) {}
public:
public:
//! \brief Empty destructor
virtual ~SplineField() {}
// Returns number of space dimensions
//! \brief Returns number of space dimensions.
unsigned char getNoSpaceDim() const { return nsd; }
// Returns number of space dimensions
//! \brief Returns number of elements.
int getNoElm() const { return nelm; }
// Returns number of control points
//! \brief Returns number of control points.
int getNoNodes() const { return nno; }
// Returns name of spline field
//! \brief Returns name of spline field.
const char* getFieldName() const { return fieldname; }
// Sets the name of the spline field
void setFieldName(char* name) { fieldname = name; }
//! \brief Sets the name of the spline field.
void setFieldName(const char* name) { fieldname = const_cast<char*>(name); }
//! \brief Initializes the field values.
void fill(const Vector& vec) { values = vec; }
// Methods to initialize field
virtual void fill(Vector& vec) { values = vec; }
// Methods to compute field values
//================================================
//================================
//! \brief Computes the value in a given node/control point
//! \param[in] node Node number
//! \brief Computes the value in a given node/control point.
//! \param[in] node Node number
virtual double valueNode(int node) const = 0;
//! \brief Computes the value at a given local coordinate
//! \brief Computes the value at a given local coordinate.
//! \param[in] fe Finite element definition
virtual double valueFE(const FiniteElement& fe) const = 0;
//! \brief Computed the value at a given global coordinate
//! \brief Computed the value at a given global coordinate.
//! \param[in] x Global/physical coordinate for point
virtual double valueCoor(const Vec3& x) const = 0;
//! \brief Computes the gradient for a given local coordinate
//! \brief Computes the gradient for a given local coordinate.
//! \param[in] fe Finite element
//! \param[out] grad Gradient of solution in a given local coordinate
virtual bool gradFE(const FiniteElement& fe, Vector& grad) const = 0;
//! \brief Computes the gradient for a given global/physical coordinate
//! \brief Computes the gradient for a given global/physical coordinate.
//! \param[in] x Global coordinate
//! \param[out] grad Gradient of solution in a given global coordinate
virtual bool gradCoor(const Vec3& x, Vector& grad) const = 0;
protected:
// Dimension of field
unsigned char nsd; //!< Number of space dimensions
int nelm; //!< Number of elements/knot-spans
int nno; //!< Number of nodes/control points
// Fieldname
char* fieldname; //!< Name of spline element field
// Field values
Vector values; //!< Field values
protected:
unsigned char nsd; //!< Number of space dimensions
int nelm; //!< Number of elements/knot-spans
int nno; //!< Number of nodes/control points
char* fieldname; //!< Name of spline element field
Vector values; //!< Field values
};
#endif

View File

@ -1,3 +1,4 @@
// $Id$
//==============================================================================
//!
//! \file SplineField2D.C
@ -6,21 +7,17 @@
//!
//! \author Runar Holdahl / SINTEF
//!
//! \brief Base class for spline based finite element field in 2D
//! \brief Class for spline-based finite element scalar field in 2D.
//!
//==============================================================================
#include "SplineField2D.h"
#include <algorithm>
#include "GoTools/geometry/SplineUtils.h"
#ifndef __BORLANDC__
#include "boost/lambda/lambda.hpp"
#endif
#include "FiniteElement.h"
#include "Vec3.h"
#include "GoTools/geometry/SplineSurface.h"
#include "GoTools/geometry/SplineUtils.h"
using namespace std;
#ifndef __BORLANDC__
using namespace boost::lambda;
#endif
SplineField2D::SplineField2D(Go::SplineSurface *geometry, char* name)
: SplineField(2,name), surf(geometry)
@ -49,17 +46,12 @@ double SplineField2D::valueNode(int node) const
}
// double SplineField2D::valueFE(const FiniteElement& fe) const
// {
// Go::Point pt;
// surf->pointValue(pt,values,fe.u,fe.v);
// return pt[0];
// }
double SplineField2D::valueFE(const FiniteElement& fe) const
{
// Go::Point pt;
// surf->pointValue(pt,values,fe.u,fe.v);
// return pt[0];
const int uorder = surf->order_u();
const int vorder = surf->order_v();
const int unum = surf->numCoefs_u();
@ -139,9 +131,9 @@ double SplineField2D::valueCoor(const Vec3& x) const
}
// bool SplineField2D::gradFE(const FiniteElement& fe, Vector& grad) const
// {
// if (!surf) return false;
bool SplineField2D::gradFE(const FiniteElement& fe, Vector& grad) const
{
if (!surf) return false;
// // Derivatives of solution in parametric space
// std::vector<Go::Point> pts(3);
@ -169,14 +161,6 @@ double SplineField2D::valueCoor(const Vec3& x) const
// // df/dX = Jac^-T * df/dXi = [dX/dXi]^-T * df/dXi
// Jac.multiply(gradXi,grad,true,false);
// return true;
// }
bool SplineField2D::gradFE(const FiniteElement& fe, Vector& grad) const
{
if (!surf) return false;
// Gradient of field wrt parametric coordinates
Vector gradXi(2);

View File

@ -1,3 +1,4 @@
// $Id$
//==============================================================================
//!
//! \file SplineField2D.h
@ -6,71 +7,65 @@
//!
//! \author Runar Holdahl / SINTEF
//!
//! \brief Base class for spline based finite element field in 2D
//! \brief Class for spline-based finite element scalar fields in 2D.
//!
//==============================================================================
#ifndef _SPLINE_FIELD_2D_H
#define _SPLINE_FIELD_2D_H
#include "SplineField.h"
namespace Go {
class SplineSurface;
class Point;
}
#include "SplineField.h"
#include "GoTools/geometry/SplineSurface.h"
/*
\brief Base class for spline-based finite element fields in 2D.
/*!
\brief Class for spline-based finite element scalar fields in 2D.
\details This class implements the functions required to evaluate
a 2D spline field at a given point in parametrical or physical
coordinates.
\details This class implements the functions required to evaluate a 2D
spline scalar field at a given point in parametrical or physical coordinates.
*/
class SplineField2D : public SplineField
{
public:
public:
//! \brief The constructor sets the number of space dimensions and fields.
//! \param[in] geometry Spline volume geometry
//! \param[in] geometry Spline surface geometry
//! \param[in] name Name of spline field
SplineField2D(Go::SplineSurface *geometry, char* name = NULL);
//! \brief Empty destructor
SplineField2D(Go::SplineSurface *geometry, char* name = NULL);
//! \brief Empty destructor.
virtual ~SplineField2D();
// Methods to compute field values
//================================================
//================================
//! \brief Computes the value in a given node/control point
//! \param[in] node Node number
//! \brief Computes the value in a given node/control point.
//! \param[in] node Node number
double valueNode(int node) const;
//! \brief Computes the value at a given local coordinate
//! \brief Computes the value at a given local coordinate.
//! \param[in] fe Finite element definition
double valueFE(const FiniteElement& fe) const;
//! \brief Computed the value at a given global coordinate
//! \brief Computed the value at a given global coordinate.
//! \param[in] x Global/physical coordinate for point
double valueCoor(const Vec3& x) const;
//! \brief Computes the gradient for a given local coordinate
//! \brief Computes the gradient for a given local coordinate.
//! \param[in] fe Finite element
//! \param[out] grad Gradient of solution in a given local coordinate
bool gradFE(const FiniteElement& fe, Vector& grad) const;
//! \brief Computes the gradient for a given global/physical coordinate
//! \brief Computes the gradient for a given global/physical coordinate.
//! \param[in] x Global coordinate
//! \param[out] grad Gradient of solution in a given global coordinate
bool gradCoor(const Vec3& x, Vector& grad) const;
protected:
Go::SplineSurface *surf; //!< Spline surface geometry description
protected:
Go::SplineSurface* surf; //!< Spline surface geometry description
};
#endif

View File

@ -1,3 +1,4 @@
// $Id$
//==============================================================================
//!
//! \file SplineField3D.C
@ -6,21 +7,21 @@
//!
//! \author Runar Holdahl / SINTEF
//!
//! \brief Base class for spline based finite element field in 3D
//! \brief Class for spline-based finite element scalar field in 3D.
//!
//==============================================================================
#include "SplineField3D.h"
#include <algorithm>
#include "GoTools/geometry/SplineUtils.h"
#ifndef __BORLANDC__
#include "boost/lambda/lambda.hpp"
#endif
#include "FiniteElement.h"
#include "Vec3.h"
#include "GoTools/trivariate/SplineVolume.h"
#include "GoTools/geometry/SplineUtils.h"
namespace Go {
void volume_ratder(double const eder[],int idim,int ider,double gder[]);
}
using namespace std;
#ifndef __BORLANDC__
using namespace boost::lambda;
#endif
SplineField3D::SplineField3D(Go::SplineVolume *geometry, char* name)
: SplineField(3,name), vol(geometry)
@ -51,17 +52,12 @@ double SplineField3D::valueNode(int node) const
}
// double SplineField3D::valueFE(const FiniteElement& fe) const
// {
// Go::Point pt;
// vol->pointValue(pt,values,fe.u,fe.v,fe.w);
// return pt[0];
// }
double SplineField3D::valueFE(const FiniteElement& fe) const
{
// Go::Point pt;
// vol->pointValue(pt,values,fe.u,fe.v,fe.w);
// return pt[0];
double val = 0.0;
const int uorder = vol->order(0);
@ -161,9 +157,9 @@ double SplineField3D::valueCoor(const Vec3& x) const
}
// bool SplineField3D::gradFE(const FiniteElement& fe, Vector& grad) const
// {
// if (!vol) return false;
bool SplineField3D::gradFE(const FiniteElement& fe, Vector& grad) const
{
if (!vol) return false;
// // Derivatives of solution in parametric space
// std::vector<Go::Point> pts;
@ -192,14 +188,6 @@ double SplineField3D::valueCoor(const Vec3& x) const
// // df/dX = Jac^-T * df/dXi = [dX/dXi]^-T * df/dXi
// Jac.multiply(gradXi,grad,true,false);
// return true;
// }
bool SplineField3D::gradFE(const FiniteElement& fe, Vector& grad) const
{
if (!vol) return false;
// Gradient of field wrt parametric coordinates
Vector gradXi(3);
@ -225,7 +213,7 @@ bool SplineField3D::gradFE(const FiniteElement& fe, Vector& grad) const
const bool rational = vol->rational();
// Take care of the rational case
const vector<double>::iterator co = rational ? vol->rcoefs_begin() : vol->coefs_begin();
const std::vector<double>::iterator co = rational ? vol->rcoefs_begin() : vol->coefs_begin();
int kdim = dim + (rational ? 1 : 0);
int ndim = ncomp + (rational ? 1 : 0);
@ -336,7 +324,7 @@ bool SplineField3D::gradFE(const FiniteElement& fe, Vector& grad) const
// Copy from restemp to result
if (rational) {
vector<double> restemp2(totpts);
std::vector<double> restemp2(totpts);
Go::volume_ratder(&restemp[0], dim, derivs, &restemp2[0]);
for (int i = 1; i < totpts; ++i)
gradXi(i) = restemp2[i];

View File

@ -1,3 +1,4 @@
// $Id$
//==============================================================================
//!
//! \file SplineField3D.h
@ -6,72 +7,65 @@
//!
//! \author Runar Holdahl / SINTEF
//!
//! \brief Base class for spline based finite element field in 3D
//! \brief Class for spline-based finite element scalar fields in 3D.
//!
//==============================================================================
#ifndef _SPLINE_FIELD_3D_H
#define _SPLINE_FIELD_3D_H
#include "SplineField.h"
namespace Go {
class SplineVolume;
class Point;
void volume_ratder(double const eder[],int idim,int ider,double gder[]);
}
#include "SplineField.h"
#include "GoTools/trivariate/SplineVolume.h"
/*
\brief Base class for spline-based finite element fields in 3D.
/*!
\brief Class for spline-based finite element scalar fields in 3D.
\details This class implements the functions required to evaluate
a 3D spline field at a given point in parametrical or physical
coordinates.
\details This class implements the functions required to evaluate a 3D
spline scalar field at a given point in parametrical or physical coordinates.
*/
class SplineField3D : public SplineField
{
public:
public:
//! \brief The constructor sets the number of space dimensions and fields.
//! \param[in] geometry Spline geometry
//! \param[in] geometry Spline volume geometry
//! \param[in] name Name of spline field
SplineField3D(Go::SplineVolume *geometry, char* name = NULL);
//! \brief Empty destructor
SplineField3D(Go::SplineVolume *geometry, char* name = NULL);
//! \brief Empty destructor.
virtual ~SplineField3D();
// Methods to compute field values
//================================================
//================================
//! \brief Computes the value in a given node/control point
//! \param[in] node Node number
//! \brief Computes the value in a given node/control point.
//! \param[in] node Node number
double valueNode(int node) const;
//! \brief Computes the value at a given local coordinate
//! \brief Computes the value at a given local coordinate.
//! \param[in] fe Finite element definition
double valueFE(const FiniteElement& fe) const;
//! \brief Computed the value at a given global coordinate
//! \brief Computed the value at a given global coordinate.
//! \param[in] x Global/physical coordinate for point
double valueCoor(const Vec3& x) const;
//! \brief Computes the gradient for a given local coordinate
//! \brief Computes the gradient for a given local coordinate.
//! \param[in] fe Finite element
//! \param[out] grad Gradient of solution in a given local coordinate
bool gradFE(const FiniteElement& fe, Vector& grad) const;
//! \brief Computes the gradient for a given global/physical coordinate
//! \brief Computes the gradient for a given global/physical coordinate.
//! \param[in] x Global coordinate
//! \param[out] grad Gradient of solution in a given global coordinate
bool gradCoor(const Vec3& x, Vector& grad) const;
protected:
Go::SplineVolume *vol; //!< Spline volume geometry description
protected:
Go::SplineVolume* vol; //!< Spline volume geometry description
};
#endif

View File

@ -1,3 +1,4 @@
// $Id$
//==============================================================================
//!
//! \file SplineFields.h
@ -6,106 +7,98 @@
//!
//! \author Runar Holdahl / SINTEF
//!
//! \brief Base class for spline based finite element vector field
//! \brief Base class for spline-based finite element vector fields.
//!
//==============================================================================
#ifndef _SPLINE_FIELDS_H
#define _SPLINE_FIELDS_H
#include "Vec3.h"
#include "MatVec.h"
#include "FiniteElement.h"
/*
\brief Base class for spline-based finite element vector fields.
class FiniteElement;
class Vec3;
\details This class incapsulates the data and methods needed
to store and evaluate a spline finite element vector field.
This is an abstract base class and the fields associated with
specific spline objects are implemented as subclasses, for
instance 1D, 2D and 3D spline formulations.
/*!
\brief Base class for spline-based finite element vector fields.
\details This class incapsulates the data and methods needed
to store and evaluate a spline finite element vector field.
This is an abstract base class and the fields associated with
specific spline objects are implemented as subclasses,
for instance 1D, 2D and 3D spline formulations.
*/
class SplineFields
{
protected:
//! \brief The constructor sets the field name
//! \param[in] nsd Number of space dimensions (1, 2 or 3)
protected:
//! \brief The constructor sets the field name.
//! \param[in] n Number of space dimensions (1, 2 or 3)
//! \param[in] name Name of spline field
SplineFields(unsigned char nsd_, char* name = NULL)
: nsd(nsd_), fieldname(name) {}
SplineFields(unsigned char n, char* name = NULL) : nsd(n), fieldname(name) {}
public:
//! \brief Empty destructor
public:
//! \brief Empty destructor.
virtual ~SplineFields() {}
// Returns number of space dimensions
//! \brief Returns number of space dimensions.
unsigned char getNoSpaceDim() const { return nsd; }
// Returns number of fields
//! \brief Returns number of fields.
unsigned char getNoFields() const { return nf; }
// Returns number of space dimensions
//! \brief Returns number of elements.
int getNoElm() const { return nelm; }
// Returns number of control points
//! \brief Returns number of control points.
int getNoNodes() const { return nno; }
// Returns name of spline field
//! \brief Returns name of spline field.
const char* getFieldName() const { return fieldname; }
// Sets the name of the spline field
//! \brief Sets the name of the spline field.
void setFieldName(char* name) { fieldname = name; }
// Methods to initialize field
virtual void fill(Vector& vec)
{ values = vec; nf = values.size()/nno; }
//! \brief Initializes the field values.
void fill(const Vector& vec) { values = vec; nf = values.size()/nno; }
// Methods to compute field values
//================================================
//================================
//! \brief Computes the value in a given node/control point
//! \param[in] node Node number
//! \param[out] vals Node values
//! \brief Computes the value in a given node/control point.
//! \param[in] node Node number
//! \param[out] vals Node values
virtual bool valueNode(int node, Vector& vals) const = 0;
//! \brief Computes the value at a given local coordinate
//! \brief Computes the value at a given local coordinate.
//! \param[in] fe Finite element definition
//! \param[out] vals Values in local point in given element
virtual bool valueFE(const FiniteElement& fe, Vector& vals) const = 0;
//! \brief Computed the value at a given global coordinate
//! \brief Computed the value at a given global coordinate.
//! \param[in] x Global/physical coordinate for point
//! \param[in] vals Values in given physical coordinate
virtual bool valueCoor(const Vec3& x, Vector& vals) const = 0;
//! \brief Computes the gradient for a given local coordinate
//! \brief Computes the gradient for a given local coordinate.
//! \param[in] fe Finite element
//! \param[out] grad Gradient of solution in a given local coordinate
virtual bool gradFE(const FiniteElement& fe, Matrix& grad) const = 0;
//! \brief Computes the gradient for a given global/physical coordinate
//! \brief Computes the gradient for a given global/physical coordinate.
//! \param[in] x Global coordinate
//! \param[out] grad Gradient of solution in a given global coordinate
virtual bool gradCoor(const Vec3& x, Matrix& grad) const = 0;
protected:
// Dimension of field
unsigned char nsd; //!< Number of space dimensions
unsigned char nf; //!< Number of fields
int nelm; //!< Number of elements/knot-spans
int nno; //!< Number of nodes/control points
// Fieldname
char* fieldname; //!< Name of spline element field
// Field values
Vector values; //!< Field values
protected:
unsigned char nsd; //!< Number of space dimensions
unsigned char nf; //!< Number of fields
int nelm; //!< Number of elements/knot-spans
int nno; //!< Number of nodes/control points
char* fieldname; //!< Name of spline element field
Vector values; //!< Field values
};
#endif

View File

@ -1,3 +1,4 @@
// $Id$
//==============================================================================
//!
//! \file SplineFields2D.C
@ -6,21 +7,20 @@
//!
//! \author Runar Holdahl / SINTEF
//!
//! \brief Base class for spline based finite element vector field in 2D
//! \brief Class for spline-based finite element vector fields in 2D.
//!
//==============================================================================
#include "SplineFields2D.h"
#include <algorithm>
#include "FiniteElement.h"
#include "Vec3.h"
#include "GoTools/geometry/SplineSurface.h"
#include "GoTools/geometry/SplineUtils.h"
#ifndef __BORLANDC__
#include "boost/lambda/lambda.hpp"
#endif
using namespace std;
#ifndef __BORLANDC__
using namespace boost::lambda;
#endif
SplineFields2D::SplineFields2D(Go::SplineSurface *geometry, char* name)
: SplineFields(2,name), surf(geometry)
@ -52,25 +52,16 @@ bool SplineFields2D::valueNode(int node, Vector& vals) const
}
// bool SplineFields2D::valueFE(const FiniteElement& fe, Vector& vals) const
// {
// if (!surf) return false;
// Go::Point pt;
// surf->pointValue(pt,values,fe.u,fe.v);
// vals.resize(pt.size());
// for (int i = 0;i < pt.size();i++)
// vals[i] = pt[i];
// return true;
// }
bool SplineFields2D::valueFE(const FiniteElement& fe, Vector& vals) const
{
if (!surf) return false;
// Go::Point pt;
// surf->pointValue(pt,values,fe.u,fe.v);
// vals.resize(pt.size());
// for (int i = 0;i < pt.size();i++)
// vals[i] = pt[i];
const int uorder = surf->order_u();
const int vorder = surf->order_v();
const int unum = surf->numCoefs_u();
@ -131,9 +122,9 @@ bool SplineFields2D::valueFE(const FiniteElement& fe, Vector& vals) const
const double w_inv = double(1) / w;
#ifdef __BORLANDC__ //C++Builder does not support boost lambda
transform(result.begin(), result.end(), result.begin(), ScaleBy(w_inv));
std::transform(result.begin(), result.end(), result.begin(), ScaleBy(w_inv));
#else
transform(result.begin(), result.end(), result.begin(), _1 * w_inv);
std::transform(result.begin(), result.end(), result.begin(), boost::lambda::_1 * w_inv);
#endif
}
else {
@ -170,9 +161,9 @@ bool SplineFields2D::valueCoor(const Vec3& x, Vector& vals) const
}
// bool SplineFields2D::gradFE(const FiniteElement& fe, Matrix& grad) const
// {
// if (!surf) return false;
bool SplineFields2D::gradFE(const FiniteElement& fe, Matrix& grad) const
{
if (!surf) return false;
// // Derivatives of solution in parametric space
// std::vector<Go::Point> pts(3);
@ -201,14 +192,6 @@ bool SplineFields2D::valueCoor(const Vec3& x, Vector& vals) const
// // df/dX = df/dXi * Jac^-1 = df/dXi * [dX/dXi]^-1
// grad.multiply(gradXi,Jac);
// return true;
// }
bool SplineFields2D::gradFE(const FiniteElement& fe, Matrix& grad) const
{
if (!surf) return false;
// Gradient of field
Matrix gradXi(nf,2);

View File

@ -1,3 +1,4 @@
// $Id$
//==============================================================================
//!
//! \file SplineFields2D.h
@ -6,73 +7,68 @@
//!
//! \author Runar Holdahl / SINTEF
//!
//! \brief Base class for spline based finite element vector field in 2D
//! \brief Class for spline-based finite element vector fields in 2D.
//!
//==============================================================================
#ifndef _SPLINE_FIELDS_2D_H
#define _SPLINE_FIELDS_2D_H
#include "SplineFields.h"
namespace Go {
class SplineSurface;
}
#include "SplineFields.h"
#include "GoTools/geometry/SplineSurface.h"
/*
\brief Class for spline-based finite element vector fields in 2D.
\details This class implements the functions required to evaluate
a 2D spline vector field at a given point in parametrical or physical
coordinates.
/*!
\brief Class for spline-based finite element vector fields in 2D.
\details This class implements the functions required to evaluate a 2D
spline vector field at a given point in parametrical or physical coordinates.
*/
class SplineFields2D : public SplineFields
{
public:
//! \brief The constructor sets the field name
//! \param[in] geometry Spline volume geometry
public:
//! \brief The constructor sets the field name.
//! \param[in] geometry Spline surface geometry
//! \param[in] name Name of spline field
SplineFields2D(Go::SplineSurface *geometry, char* name = NULL);
//! \brief Empty destructor
SplineFields2D(Go::SplineSurface *geometry, char* name = NULL);
//! \brief Empty destructor.
virtual ~SplineFields2D();
// Methods to compute field values
//================================================
//================================
//! \brief Computes the value in a given node/control point
//! \param[in] node Node number
//! \param[out] vals Node values
//! \brief Computes the value in a given node/control point.
//! \param[in] node Node number
//! \param[out] vals Node values
bool valueNode(int node, Vector& vals) const;
//! \brief Computes the value at a given local coordinate
//! \brief Computes the value at a given local coordinate.
//! \param[in] fe Finite element definition
//! \param[out] vals Values in local point in given element
bool valueFE(const FiniteElement& fe, Vector& vals) const;
//! \brief Computed the value at a given global coordinate
//! \brief Computed the value at a given global coordinate.
//! \param[in] x Global/physical coordinate for point
//! \param[in] vals Values in given physical coordinate
bool valueCoor(const Vec3& x, Vector& vals) const;
//! \brief Computes the gradient for a given local coordinate
//! \brief Computes the gradient for a given local coordinate.
//! \param[in] fe Finite element
//! \param[out] grad Gradient of solution in a given local coordinate
bool gradFE(const FiniteElement& fe, Matrix& grad) const;
//! \brief Computes the gradient for a given global/physical coordinate
//! \brief Computes the gradient for a given global/physical coordinate.
//! \param[in] x Global coordinate
//! \param[out] grad Gradient of solution in a given global coordinate
bool gradCoor(const Vec3& x, Matrix& grad) const;
protected:
Go::SplineSurface *surf; //!< Spline surface geometry description
protected:
Go::SplineSurface* surf; //!< Spline surface geometry description
};
#endif

View File

@ -1,3 +1,4 @@
// $Id$
//==============================================================================
//!
//! \file SplineFields3D.C
@ -6,22 +7,22 @@
//!
//! \author Runar Holdahl / SINTEF
//!
//! \brief Base class for spline based finite element vector field in 3D
//! \brief Class for spline-based finite element vector fields in 3D.
//!
//==============================================================================
#include "SplineFields3D.h"
#include <algorithm>
#include "GoTools/geometry/SplineUtils.h"
#ifndef __BORLANDC__
#include "boost/lambda/lambda.hpp"
#endif
#include "FiniteElement.h"
#include "Vec3.h"
#include "GoTools/trivariate/SplineVolume.h"
#include "GoTools/geometry/SplineUtils.h"
#include "boost/lambda/lambda.hpp"
namespace Go {
void volume_ratder(double const eder[],int idim,int ider,double gder[]);
}
using namespace std;
#ifndef __BORLANDC__
using namespace boost::lambda;
#endif
SplineFields3D::SplineFields3D(Go::SplineVolume *geometry, char* name)
: SplineFields(3,name), vol(geometry)
@ -55,27 +56,17 @@ bool SplineFields3D::valueNode(int node, Vector& vals) const
}
// bool SplineFields3D::valueFE(const FiniteElement& fe, Vector& vals) const
// {
// if (!vol) return false;
// Go::Point pt;
// vol->pointValue(pt,values,fe.u,fe.v,fe.w);
// vals.resize(pt.size());
// for (int i = 0;i < pt.size();i++)
// vals[i] = pt[i];
// return true;
// }
bool SplineFields3D::valueFE(const FiniteElement& fe, Vector& vals) const
{
if (!vol) return false;
Go::Point pt;
// vol->pointValue(pt,values,fe.u,fe.v,fe.w);
// vals.resize(pt.size());
// for (int i = 0;i < pt.size();i++)
// vals[i] = pt[i];
const int uorder = vol->order(0);
const int vorder = vol->order(1);
const int worder = vol->order(2);
@ -181,10 +172,10 @@ bool SplineFields3D::valueFE(const FiniteElement& fe, Vector& vals) const
}
}
copy(tempResult.begin(), tempResult.begin() + dim, pt.begin());
std::copy(tempResult.begin(), tempResult.begin() + dim, pt.begin());
if (rational) {
const double w_inv = double(1) / w;
transform(pt.begin(), pt.end(), pt.begin(), _1 * w_inv);
std::transform(pt.begin(), pt.end(), pt.begin(), boost::lambda::_1 * w_inv);
}
vals.resize(pt.size());
@ -203,9 +194,9 @@ bool SplineFields3D::valueCoor(const Vec3& x, Vector& vals) const
}
// bool SplineFields3D::gradFE(const FiniteElement& fe, Matrix& grad) const
// {
// if (!vol) return false;
bool SplineFields3D::gradFE(const FiniteElement& fe, Matrix& grad) const
{
if (!vol) return false;
// // Derivatives of solution in parametric space
// std::vector<Go::Point> pts;
@ -232,14 +223,6 @@ bool SplineFields3D::valueCoor(const Vec3& x, Vector& vals) const
// // df/dX = df/dXi * Jac^-1 = df/dXi * [dX/dXi]^-1
// grad.multiply(gradXi,Jac);
// return true;
// }
bool SplineFields3D::gradFE(const FiniteElement& fe, Matrix& grad) const
{
if (!vol) return false;
// Derivatives of solution in parametric space
std::vector<Go::Point> pts(4);
@ -271,7 +254,7 @@ bool SplineFields3D::gradFE(const FiniteElement& fe, Matrix& grad) const
}
// Take care of the rational case
const vector<double>::iterator co = rational ? vol->rcoefs_begin() : vol->coefs_begin();
const std::vector<double>::iterator co = rational ? vol->rcoefs_begin() : vol->coefs_begin();
int kdim = dim + (rational ? 1 : 0);
int ndim = ncomp + (rational ? 1 : 0);
@ -386,7 +369,7 @@ bool SplineFields3D::gradFE(const FiniteElement& fe, Matrix& grad) const
// Copy from restemp to result
if (rational) {
vector<double> restemp2(totpts*ncomp);
std::vector<double> restemp2(totpts*ncomp);
Go::volume_ratder(&restemp[0], dim, derivs, &restemp2[0]);
for (int i = 0; i < totpts; ++i) {
for (int d = 0; d < ncomp; ++d) {

View File

@ -1,3 +1,4 @@
// $Id$
//==============================================================================
//!
//! \file SplineFields3D.h
@ -6,75 +7,68 @@
//!
//! \author Runar Holdahl / SINTEF
//!
//! \brief Base class for spline based finite element vector field in 3D
//! \brief Class for spline-based finite element vector fields in 3D.
//!
//==============================================================================
#ifndef _SPLINE_FIELDS_3D_H
#define _SPLINE_FIELDS_3D_H
#include "SplineFields.h"
namespace Go {
class SplineVolume;
class Point;
void volume_ratder(double const eder[],int idim,int ider,double gder[]);
}
#include "SplineFields.h"
#include "GoTools/trivariate/SplineVolume.h"
/*
\brief Class for spline-based finite element vector fields in 3D.
\details This class implements the functions required to evaluate
a 3D spline vector field at a given point in parametrical or physical
coordinates.
/*!
\brief Class for spline-based finite element vector fields in 3D.
\details This class implements the functions required to evaluate a 3D
spline vector field at a given point in parametrical or physical coordinates.
*/
class SplineFields3D : public SplineFields
{
public:
//! \brief The constructor sets the field name
public:
//! \brief The constructor sets the field name.
//! \param[in] geometry Spline volume geometry
//! \param[in] name Name of spline field
SplineFields3D(Go::SplineVolume *geometry, char* name = NULL);
//! \brief Empty destructor
SplineFields3D(Go::SplineVolume *geometry, char* name = NULL);
//! \brief Empty destructor.
virtual ~SplineFields3D();
// Methods to compute field values
//================================================
//================================
//! \brief Computes the value in a given node/control point
//! \param[in] node Node number
//! \param[out] vals Node values
//! \brief Computes the value in a given node/control point.
//! \param[in] node Node number
//! \param[out] vals Node values
bool valueNode(int node, Vector& vals) const;
//! \brief Computes the value at a given local coordinate
//! \brief Computes the value at a given local coordinate.
//! \param[in] fe Finite element definition
//! \param[out] vals Values in local point in given element
bool valueFE(const FiniteElement& fe, Vector& vals) const;
//! \brief Computed the value at a given global coordinate
//! \brief Computed the value at a given global coordinate.
//! \param[in] x Global/physical coordinate for point
//! \param[in] vals Values in given physical coordinate
bool valueCoor(const Vec3& x, Vector& vals) const;
//! \brief Computes the gradient for a given local coordinate
//! \brief Computes the gradient for a given local coordinate.
//! \param[in] fe Finite element
//! \param[out] grad Gradient of solution in a given local coordinate
bool gradFE(const FiniteElement& fe, Matrix& grad) const;
//! \brief Computes the gradient for a given global/physical coordinate
//! \brief Computes the gradient for a given global/physical coordinate.
//! \param[in] x Global coordinate
//! \param[out] grad Gradient of solution in a given global coordinate
bool gradCoor(const Vec3& x, Matrix& grad) const;
protected:
Go::SplineVolume *vol; //!< Spline volume geometry description
protected:
Go::SplineVolume* vol; //!< Spline volume geometry description
};
#endif