Index: Array/Array.h =================================================================== RCS file: /home/pooma/Repository/r2/src/Array/Array.h,v retrieving revision 1.140 diff -c -p -r1.140 Array.h *** Array/Array.h 2001/05/14 21:11:22 1.140 --- Array/Array.h 2001/05/25 17:37:49 *************** struct View1, D *** 642,647 **** --- 642,649 ---- // an existing engine cannot be any kind of slice domain. // Also, bounds checking would make no sense because it would // reduce to contains(a.domain(), a.domain()); + // + // Any changes to this class should also be made to AltView0. template struct View0 > *************** struct View0 > *** 686,691 **** --- 688,728 ---- } }; + // AltView0 avoids an instantiation problem that arises when two + // classes use each other. This class's definition should be exactly + // the same as View0 except omitting member functions. + // + // Do NOT explicitly instantiate this class. + + template + struct AltView0; + + template + struct AltView0 > + { + // Convenience typedef for the thing we're taking a view of. + + typedef Array Subject_t; + + // Deduce domains for the output type. + // At some point, we need to fix NewDomain1; until then, use + // the temporary version from Array.h. + + typedef typename Subject_t::Engine_t Engine_t; + typedef typename Subject_t::Domain_t Domain_t; + + // Deduce the template parameters for the output type. + + typedef typename NewEngine::Type_t NewEngine_t; + enum { newDim = NewEngine_t::dimensions }; + typedef typename NewEngine_t::Tag_t NewEngineTag_t; + + // The output types. + + typedef Array Type_t; + typedef Type_t ReadType_t; + }; + template struct View1, int> { *************** struct Patch > *** 1278,1283 **** --- 1315,1321 ---- //----------------------------------------------------------------------------- // ComponentView specialization for Array. + // Changes to ComponentView should also be made to AltComponentView. //----------------------------------------------------------------------------- template *************** struct ComponentView --- 1352,1362 ---- }; //----------------------------------------------------------------------------- ! // AltComponentView avoids an instantiation problem that arises when ! // two classes use each other. These classes' definitions should be ! // exactly the same as ComponentView except omitting member functions. ! // ! // Do NOT explicitly instantiate these alternative classes. //----------------------------------------------------------------------------- template *************** public: *** 1785,1791 **** // A zero-argument version of operator(), which takes a view of // array's domain, is also supplied. ! typename View0::ReadType_t read() const { typedef View0 Ret_t; --- 1826,1832 ---- // A zero-argument version of operator(), which takes a view of // array's domain, is also supplied. ! typename AltView0::ReadType_t read() const { typedef View0 Ret_t; *************** public: *** 1855,1861 **** return Ret_t::makeRead(*this, s1, s2, s3, s4, s5, s6, s7); } ! typename View0::Type_t operator()() const { typedef View0 Ret_t; --- 1896,1902 ---- return Ret_t::makeRead(*this, s1, s2, s3, s4, s5, s6, s7); } ! typename AltView0::Type_t operator()() const { typedef View0 Ret_t; Index: NewField/Field.h =================================================================== RCS file: /home/pooma/Repository/r2/src/NewField/Field.h,v retrieving revision 1.13 diff -c -p -r1.13 Field.h *** NewField/Field.h 2001/05/14 21:11:24 1.13 --- NewField/Field.h 2001/05/25 17:37:51 *************** public: *** 187,192 **** --- 187,195 ---- // View1Implementation specialization for indexing a field // with a single domain. There is a single-valued version (SV == true) // and a multi-valued version (SV == false). + // + // Any changes to View1Implementation should also be made to + // AltView1Implementation. //----------------------------------------------------------------------------- // Single-valued version. Handles scalars and Locs. *************** struct View1Implementation + struct AltView1Implementation; + + template + struct AltView1Implementation, Domain, true> + { + // Convenience typedef for the thing we're taking a view of. + + typedef Field Subject_t; + + // The return types are pretty simple here. + + typedef typename Subject_t::Element_t ReadType_t; + typedef typename Subject_t::ElementRef_t Type_t; + }; + + template + struct AltView1Implementation, Domain, false> + { + // Convenience typedef for the thing we're taking a view of. + + typedef Field Subject_t; + + // Deduce domains for the output type. + + typedef typename Subject_t::Engine_t Engine_t; + typedef typename NewEngine::Type_t NewEngine_t; + typedef typename NewEngine_t::Element_t NewT_t; + typedef typename NewEngine_t::Tag_t NewEngineTag_t; + + // Deduce the new GeometryTag. + + typedef typename + NewGeometryTag::Type_t + NewGeometryTag_t; + + // The output types. + + typedef Field ReadType_t; + typedef Field Type_t; + }; + + + //----------------------------------------------------------------------------- // View1 specialization for indexing a field with a single domain. + // + // Any changes to View1 should also be made to AltView1. //----------------------------------------------------------------------------- template *************** struct View1 specialization for indexing a field with an int. + // + // Any changes to View1 should also be made to AltView1. //----------------------------------------------------------------------------- template *************** struct View1 + struct AltView1; + + template + struct AltView1, Sub1> + { + // Convenience typedef for the thing we're taking a view of. + + typedef Field Subject_t; + + // Deduce domains for the output type. + // At some point, we need to fix NewDomain1; until then, use + // the temporary version from NewDomain.h. + + typedef typename Subject_t::Domain_t Domain_t; + typedef TemporaryNewDomain1 NewDomain_t; + typedef typename NewDomain_t::SliceType_t SDomain_t; + + // Deduce appropriate version of implementation to dispatch to. + + static const bool sv = DomainTraits::singleValued; + typedef AltView1Implementation Dispatch_t; + + // The optimized domain combiner. + + typedef CombineDomainOpt Combine_t; + + // The return types. + + typedef typename Dispatch_t::ReadType_t ReadType_t; + typedef typename Dispatch_t::Type_t Type_t; + }; + + + //----------------------------------------------------------------------------- + // AltView1 avoids an instantiation problem that arises when two + // classes use each other. This class's definition should be exactly + // the same as View1 except omitting member functions. + // + // Do NOT explicitly instantiate this class. + //----------------------------------------------------------------------------- + + template + struct AltView1, int> + { + // Convenience typedef for the thing we're taking a view of. + + typedef Field Subject_t; + + // The return types. + + typedef typename Subject_t::Element_t ReadType_t; + typedef typename Subject_t::ElementRef_t Type_t; + + }; + + + //----------------------------------------------------------------------------- + // AltView1 avoids an instantiation problem that arises when two + // classes use each other. This class's definition should be exactly + // the same as View1 except omitting member functions. + // + // Do NOT explicitly instantiate this class. + //----------------------------------------------------------------------------- + + template + struct AltView1; + + template + struct AltView1, Sub1> + { + // Convenience typedef for the thing we're taking a view of. + + typedef Field Subject_t; + + // Deduce domains for the output type. + // At some point, we need to fix NewDomain1; until then, use + // the temporary version from NewDomain.h. + + typedef typename Subject_t::Domain_t Domain_t; + typedef TemporaryNewDomain1 NewDomain_t; + typedef typename NewDomain_t::SliceType_t SDomain_t; + + // Deduce appropriate version of implementation to dispatch to. + + static const bool sv = DomainTraits::singleValued; + typedef View1Implementation Dispatch_t; + + // The optimized domain combiner. + + typedef CombineDomainOpt Combine_t; + + // The return types. + + typedef typename Dispatch_t::ReadType_t ReadType_t; + typedef typename Dispatch_t::Type_t Type_t; + }; + + + //----------------------------------------------------------------------------- + // AltView1 avoids an instantiation problem that arises when two + // classes use each other. This class's definition should be exactly + // the same as View1 except omitting member functions. + // + // Do NOT explicitly instantiate this class. + //----------------------------------------------------------------------------- + + template + struct AltView1, int> + { + // Convenience typedef for the thing we're taking a view of. + + typedef Field Subject_t; + + // The return types. + + typedef typename Subject_t::Element_t ReadType_t; + typedef typename Subject_t::ElementRef_t Type_t; + + }; + + + //----------------------------------------------------------------------------- // View2 specialization for indexing a field with two // domains. //----------------------------------------------------------------------------- *************** public: *** 1010,1023 **** // version returns a view of the physical domain and the 'All'-suffixed // versions return a view of the total domain. ! inline typename View1::ReadType_t read() const { typedef View1 Ret_t; return Ret_t::makeRead(*this, physicalDomain()); } ! inline typename View1::ReadType_t readAll() const { typedef View1 Ret_t; --- 1200,1213 ---- // version returns a view of the physical domain and the 'All'-suffixed // versions return a view of the total domain. ! inline typename AltView1::ReadType_t read() const { typedef View1 Ret_t; return Ret_t::makeRead(*this, physicalDomain()); } ! inline typename AltView1::ReadType_t readAll() const { typedef View1 Ret_t; *************** public: *** 1025,1031 **** } template ! inline typename View1::ReadType_t read(const Sub1 &s1) const { typedef View1 Ret_t; --- 1215,1221 ---- } template ! inline typename AltView1::ReadType_t read(const Sub1 &s1) const { typedef View1 Ret_t; *************** public: *** 1048,1061 **** return Ret_t::makeRead(*this, s1, s2, s3); } ! inline typename View1::Type_t operator()() const { typedef View1 Ret_t; return Ret_t::make(*this, physicalDomain()); } ! inline typename View1::Type_t all() const { typedef View1 Ret_t; --- 1238,1251 ---- return Ret_t::makeRead(*this, s1, s2, s3); } ! inline typename AltView1::Type_t operator()() const { typedef View1 Ret_t; return Ret_t::make(*this, physicalDomain()); } ! inline typename AltView1::Type_t all() const { typedef View1 Ret_t; *************** public: *** 1063,1069 **** } template ! inline typename View1::Type_t operator()(const Sub1 &s1) const { typedef View1 Ret_t; --- 1253,1259 ---- } template ! inline typename AltView1::Type_t operator()(const Sub1 &s1) const { typedef View1 Ret_t;