00001 #include "fdomainunion.h" 00002 00009 FDomainUnion::FDomainUnion(Function3D *f1,Function3D *f2, bool delObjs) 00010 { 00011 m_functions.push_back(f1); 00012 m_functions.push_back(f2); 00013 m_delObjs = delObjs; 00014 00015 } 00016 00017 00018 00019 00020 00021 00022 bool FDomainUnion::isInDomain(const VecDouble &p,unsigned component) const 00023 { 00024 for (unsigned i=0;i<m_functions.size();i++) 00025 { 00026 if (m_functions[i]->isInDomain(p,component)) 00027 return true; 00028 } 00029 return false; 00030 } 00031 00032 00033 00034 00035 double FDomainUnion::operator()(const VecDouble &p, const unsigned int component) const 00036 { 00037 for (unsigned i=0;i<m_functions.size();i++) 00038 { 00039 if (m_functions[i]->isInDomain(p,component)) 00040 return (*(m_functions[i]))(p,component); 00041 } 00042 return 0.0; 00043 } 00044 00045 00046 00047 00048 FDomainUnion::~FDomainUnion() 00049 { 00050 if (!m_delObjs) 00051 return; 00052 for (unsigned i=0;i<m_functions.size();i++) 00053 { 00054 delete m_functions[i]; 00055 } 00056 }