00001 #ifdef CH_LANG_CC 00002 /* 00003 * _______ __ 00004 * / ___/ / ___ __ _ / / ___ 00005 * / /__/ _ \/ _ \/ V \/ _ \/ _ \ 00006 * \___/_//_/\___/_/_/_/_.__/\___/ 00007 * Please refer to Copyright.txt, in Chombo's root directory. 00008 */ 00009 #endif 00010 00011 // ANAG, LBNL 00012 00013 #ifndef _BASEIVFACTORYI_H_ 00014 #define _BASEIVFACTORYI_H_ 00015 #include "NamespaceHeader.H" 00016 00017 /***************/ 00018 /***************/ 00019 template <class T> inline 00020 BaseIVFactory<T>::~BaseIVFactory() 00021 { 00022 } 00023 /***************/ 00024 /***************/ 00025 template <class T> inline 00026 BaseIVFactory<T>::BaseIVFactory(const EBISLayout& a_ebisl, 00027 const LayoutData<IntVectSet>& a_sets) 00028 { 00029 m_ebisl = a_ebisl; 00030 m_sets.define(a_sets.boxLayout()); 00031 for(DataIterator dit = m_sets.dataIterator(); dit.ok(); ++dit) 00032 { 00033 m_sets[dit()] = a_sets[dit()]; 00034 } 00035 } 00036 00037 template <class T> inline 00038 BaseIVFactory<T>::BaseIVFactory(const EBISLayout& a_ebisl) 00039 { 00040 m_ebisl = a_ebisl; 00041 m_sets.define(a_ebisl.getDisjointLayout()); 00042 DisjointBoxLayout layout = a_ebisl.getDisjointLayout(); 00043 for(DataIterator dit = m_sets.dataIterator(); dit.ok(); ++dit) 00044 { 00045 Box region = m_ebisl[dit()].getRegion(); 00046 m_sets[dit()] = m_ebisl[dit()].boundaryIVS(region); 00047 } 00048 } 00049 /***************/ 00050 /***************/ 00051 template <class T> inline 00052 BaseIVFAB<T>* 00053 BaseIVFactory<T>::create(const Box& a_box, int a_ncomps, 00054 const DataIndex& a_dit) const 00055 { 00056 //intersects with input box because leveldata will expect 00057 //that anyway when it tries to do a copy or a linearization. 00058 IntVectSet ivsInter = m_sets[a_dit]; 00059 ivsInter &= a_box; 00060 return new BaseIVFAB<T>(ivsInter, m_ebisl[a_dit].getEBGraph(), a_ncomps); 00061 } 00062 /***************/ 00063 /***************/ 00064 00065 #include "NamespaceFooter.H" 00066 #endif