FCompoundVector Class Reference

#include <fcompoundvector.h>

Inheritance diagram for FCompoundVector:
Inheritance graph
[legend]
Collaboration diagram for FCompoundVector:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 FCompoundVector (Function3D *f1, Function3D *f2, Function3D *f3, bool deleteObjs=false)
 FCompoundVector (Function3D *f1, Function3D *f2, bool deleteObjs=false)
 FCompoundVector (std::vector< Function3D * > &vF, bool deleteObjs=false)
virtual ~FCompoundVector ()
virtual bool isInDomain (const VecDouble &p, unsigned component=0) const
virtual double operator() (const VecDouble &p, const unsigned int component=0) const

Private Attributes

std::vector< Function3D * > m_fComponents
bool m_deleteObjs

Detailed Description

This function defines a vector functions (number os components > 1) such that the values of each component is defined by a specific function passed in the contruction or the class. This class is a very ellegant way to combine multiple scalar function in just one vector function. The functions that compound this class must be scalar, in ohter words, must be number of components equal to 1.

Definition at line 13 of file fcompoundvector.h.


Constructor & Destructor Documentation

FCompoundVector::FCompoundVector ( Function3D f1,
Function3D f2,
Function3D f3,
bool  deleteObjs = false 
)

Construct the FCompoundVector of dimension 3 given the three functions (f1,f2,f3) defining the values of the components 0,1,2 respectively deleteObjs Should the class delete the function objects passed as arguments ?

Returns:

Definition at line 7 of file fcompoundvector.cpp.

00008    :Function3D(3)
00009 {
00010   assert(f1->n_components() == 1);
00011   assert(f2->n_components() == 1);
00012   assert(f3->n_components() == 1);
00013   m_fComponents.resize(3);
00014   m_fComponents[0]=f1;
00015   m_fComponents[1]=f2;
00016   m_fComponents[2]=f3;
00017   m_deleteObjs = deleteObjs;
00018 }

FCompoundVector::FCompoundVector ( Function3D f1,
Function3D f2,
bool  deleteObjs = false 
)

Definition at line 28 of file fcompoundvector.cpp.

00029    :Function3D(2)
00030  {
00031    assert(f1->n_components() == 1);
00032    assert(f2->n_components() == 1);
00033   m_fComponents.resize(2);
00034   m_fComponents[0]=f1;
00035   m_fComponents[1]=f2;
00036   m_deleteObjs = deleteObjs;
00037 
00038 }

FCompoundVector::FCompoundVector ( std::vector< Function3D * > &  vF,
bool  deleteObjs = false 
)

Definition at line 21 of file fcompoundvector.cpp.

00021                                                                           :Function3D(vF.size()) 
00022 {
00023   m_fComponents=vF;
00024   m_deleteObjs = deleteObjs;
00025 }

FCompoundVector::~FCompoundVector (  )  [virtual]

Definition at line 56 of file fcompoundvector.cpp.

00057 {
00058   if (m_deleteObjs)
00059   {
00060     for (unsigned i=0;i<m_fComponents.size();i++)
00061     {
00062       delete m_fComponents[i];
00063     }
00064   }
00065 }


Member Function Documentation

bool FCompoundVector::isInDomain ( const VecDouble p,
unsigned  component = 0 
) const [virtual]

Reimplemented from GeneralFunctionInterface.

Definition at line 41 of file fcompoundvector.cpp.

00042 {
00043   assert(component < m_fComponents.size());
00044   return m_fComponents[component]->isInDomain(p,0);
00045   
00046 }

double FCompoundVector::operator() ( const VecDouble p,
const unsigned int  component = 0 
) const [virtual]

Implements GeneralFunctionInterface.

Definition at line 49 of file fcompoundvector.cpp.

00050 {
00051   assert(component < m_fComponents.size());
00052   return (*(m_fComponents[component]))(p,0);
00053 }


Member Data Documentation

Flag to indiciate if this class shoud destroy the function pointers received in the contructor

Definition at line 17 of file fcompoundvector.h.

std::vector<Function3D*> FCompoundVector::m_fComponents [private]

vector to store the components` functions

Definition at line 16 of file fcompoundvector.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Generated on Sun Apr 8 23:13:05 2012 for CO2INJECTION by  doxygen 1.6.3