00001 #include "fcompoundvector.h" 00007 FCompoundVector::FCompoundVector(Function3D *f1, Function3D *f2, Function3D *f3,bool deleteObjs) 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 } 00019 00020 00021 FCompoundVector::FCompoundVector(std::vector<Function3D*> &vF,bool deleteObjs):Function3D(vF.size()) 00022 { 00023 m_fComponents=vF; 00024 m_deleteObjs = deleteObjs; 00025 } 00026 00027 00028 FCompoundVector::FCompoundVector(Function3D *f1, Function3D *f2,bool deleteObjs) 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 } 00039 00040 00041 bool FCompoundVector::isInDomain(const VecDouble &p,unsigned component) const 00042 { 00043 assert(component < m_fComponents.size()); 00044 return m_fComponents[component]->isInDomain(p,0); 00045 00046 } 00047 00048 00049 double FCompoundVector::operator() (const VecDouble &p, const unsigned int component) const 00050 { 00051 assert(component < m_fComponents.size()); 00052 return (*(m_fComponents[component]))(p,0); 00053 } 00054 00055 00056 FCompoundVector::~FCompoundVector() 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 } 00066 00067 00068 00069 00070 00071