PATCH: Remove old field engines

Jeffrey David Oldham oldham at CS.Stanford.EDU
Thu Sep 20 20:25:10 UTC 2001


Fields with meshes replaced fields with geometries.  Remove the old
files.

2001-09-20  Jeffrey D. Oldham  <oldham at codesourcery.com>

        * FieldEngine.Lagrangian.h: Remove this file which uses fields
        with geometries.
        * FieldEngine.NoGeometry.h: Likewise.
        * FieldEngine.UR.h: Likewise.
        * FieldEngineApply.h: Likewise.
        * FieldEngineBase.h: Likewise.

Tested on       sequential Linux using gcc 3.1 by compiling Pooma
library
and Field tests Approved by     Stephen Smith
Applied to      mainline

Thanks,
Jeffrey D. Oldham
oldham at cs.stanford.edu
-------------- next part --------------
Index: FieldEngine.Lagrangian.h
===================================================================
RCS file: FieldEngine.Lagrangian.h
diff -N FieldEngine.Lagrangian.h
*** /tmp/cvsBYwNoC	Thu Sep 20 12:08:14 2001
--- /dev/null	Fri Mar 23 21:37:44 2001
***************
*** 1,275 ****
- // -*- C++ -*-
- // ACL:license
- // ----------------------------------------------------------------------
- // This software and ancillary information (herein called "SOFTWARE")
- // called POOMA (Parallel Object-Oriented Methods and Applications) is
- // made available under the terms described here.  The SOFTWARE has been
- // approved for release with associated LA-CC Number LA-CC-98-65.
- // 
- // Unless otherwise indicated, this SOFTWARE has been authored by an
- // employee or employees of the University of California, operator of the
- // Los Alamos National Laboratory under Contract No. W-7405-ENG-36 with
- // the U.S. Department of Energy.  The U.S. Government has rights to use,
- // reproduce, and distribute this SOFTWARE. The public may copy, distribute,
- // prepare derivative works and publicly display this SOFTWARE without 
- // charge, provided that this Notice and any statement of authorship are 
- // reproduced on all copies.  Neither the Government nor the University 
- // makes any warranty, express or implied, or assumes any liability or 
- // responsibility for the use of this SOFTWARE.
- // 
- // If SOFTWARE is modified to produce derivative works, such modified
- // SOFTWARE should be clearly marked, so as not to confuse it with the
- // version available from LANL.
- // 
- // For more information about POOMA, send e-mail to pooma at acl.lanl.gov,
- // or visit the POOMA web page at http://www.acl.lanl.gov/pooma/.
- // ----------------------------------------------------------------------
- // ACL:license
- 
- //-----------------------------------------------------------------------------
- // Classes: 
- //   Lagrangian<Dim, TM, CoordinateSystem>
- //   FieldEngine<Lagrangian<...>, T, EngineTag>
- //-----------------------------------------------------------------------------
- 
- #ifndef POOMA_FIELD_FIELDENGINE_LAGRANGIAN_H
- #define POOMA_FIELD_FIELDENGINE_LAGRANGIAN_H
- 
- //-----------------------------------------------------------------------------
- // Overview: 
- // 
- // FieldEngine<Lagrangian, T, EngineTag>
- //-----------------------------------------------------------------------------
- 
- //-----------------------------------------------------------------------------
- // Includes:
- //-----------------------------------------------------------------------------
- 
- #include "Field/FieldEngine/FieldEngineBase.h"
- 
- #include "Array/Array.h"
- #include "CoordinateSystems/Cartesian.h"
- #include "Domain/Interval.h"
- #include "Engine/ConstantFunctionEngine.h"
- #include "Engine/EnginePatch.h"
- #include "Engine/IndexFunctionEngine.h"
- #include "Layout/INode.h"
- #include "PETE/PETE.h"
- #include "Pooma/Indices.h"
- #include "Tiny/Vector.h"
- #include "Utilities/PAssert.h"
- 
- 
- //-----------------------------------------------------------------------------
- // Forward Declarations:
- //-----------------------------------------------------------------------------
- 
- template<class GeometryTag, class T, class EngineTag> class FieldEngine;
- 
- 
- //-----------------------------------------------------------------------------
- // Full Description:
- // 
- // Lagrangian tag class.
- //-----------------------------------------------------------------------------
- 
- template<int Dim, class TM =  POOMA_DEFAULT_POSITION_TYPE,
-   class CoordinateSystem = Cartesian<Dim> >
- struct Lagrangian;
- 
- 
- //-----------------------------------------------------------------------------
- // Full Description:
- // 
- // FieldEngine, specialized for a rudimentary Lagrangian mesh.
- //-----------------------------------------------------------------------------
- 
- template<int Dim, class TM, class CoordinateSystem, class T, class EngineTag>
- class FieldEngine<Lagrangian<Dim, TM, CoordinateSystem>, T, EngineTag> :
-   public FieldEngineBase<Dim, T, EngineTag>
- {
- public:
- 
-   //---------------------------------------------------------------------------
-   // Exported typedefs and enumerations.
- 
-   // This class.
-   
-   typedef FieldEngine<Lagrangian<Dim, TM, CoordinateSystem>, T, EngineTag>
-     This_t;
-     
-   // Our base class.
-   
-   typedef FieldEngineBase<Dim, T, EngineTag> Base_t;
- 
-   // The geometry tag.
-   
-   typedef Lagrangian<Dim, TM, CoordinateSystem> GeometryTag_t;
-   
-   // The engine tag.
-   
-   typedef EngineTag EngineTag_t;
-   
-   // The coordinate system.
-   
-   typedef CoordinateSystem CoordinateSystem_t;
-   
-   // The domain type.
-   
-   typedef typename Base_t::Domain_t Domain_t;
-   
-   // The number of indices required to select a point in this mesh.
-   
-   enum { dimensions = Dim };
-   
-   // The type used to represent a point in the mesh.
-   
-   typedef Vector<Dim, TM> PointType_t;
-   
-   // Our engine type.
-   
-   typedef Engine<Dim, T, EngineTag> Engine_t;
-   
-   // Our layout type.
-   
-   typedef typename Engine_t::Layout_t Layout_t;
- 
- 
-   //---------------------------------------------------------------------------
-   // Constructors. We don't use default arguments for the origin and spacings
-   // because that produces ambiguities.
- 
-   template<class BaseInitializer>  
-   FieldEngine(const BaseInitializer &baseInit, 
-     const Layout_t &layout,
-     const PointType_t &origin,
-     const PointType_t &spacings)
-   : Base_t(baseInit, layout),
-     positions_m(layout)
-     {
-       positions_m = origin + iota(growRight(totalCellDomain(), 1) - 
-         physicalCellDomain().firsts()) * spacings;
-     }
-     
-   // Copy constructor.
-   
-   FieldEngine(const This_t &model)
-   : Base_t(model),
-     positions_m(model.positions_m)
-     { }
-     
-   // Copy constructor (except for updaters).
- 
-   FieldEngine(const This_t &model, const Pooma::Updaters::DontCopyUpdaters &d)
-   : Base_t(model, d),
-     positions_m(model.positions_m)
-     { }
-     
-   // Sub-field constructor.
-   
-   FieldEngine(const This_t &model, const int &iSubField)
-   : Base_t(model, iSubField),
-     positions_m(model.positions_m)
-     { }
- 
-   // Domain view constructors.
- 
-   template<class T2, class ET2>  
-   FieldEngine(const FieldEngine<GeometryTag_t, T2, ET2> &model, 
-     const Domain_t &d)
-   : Base_t(model, d),
-     positions_m(model.vertexPositions()(translateToVertexDomain(d)))
-     { }
- 
-   template<class T2, class ET2>  
-   FieldEngine(const FieldEngine<GeometryTag_t, T2, ET2> &model, 
-     const INode<Dim> &inode)
-   : Base_t(model, inode),
-     positions_m(model.vertexPositions()(inode))
-     { }
- 
-   // Note there is no change to the vertex positions, because EngineView
-   // currently is only used to support RemoteView operations which don't
-   // change the domain.
-   template<class T2, class ET2, class Tag>  
-   FieldEngine(const FieldEngine<GeometryTag_t, T2, ET2> &model, 
-     const EngineView<Tag> &engineView)
-   : Base_t(model, engineView),
-     positions_m(forEach(model.vertexPositions(), engineView, TreeCombine()))
-   { }
- 
-   // Expression-engine constructor.    
- 
-   FieldEngine(const Engine<Dim, T, EngineTag> &e)
-   : Base_t(e),
-     positions_m(referenceField().fieldEngine().vertexPositions())
-     { }
- 
-   // Patch constructor.    
- 
-   template<class ET2>
-   FieldEngine(const FieldEngine<GeometryTag_t, T, ET2> &model, 
-               const FieldEnginePatch<Dim> &p)
-   : Base_t(model, p),
-     positions_m(model.vertexPositions().patchLocal(p.patch_m))
-     { }
- 
- 
-   //---------------------------------------------------------------------------
-   // Copy assignment operator (shallow).
-   
-   This_t &operator=(const This_t &rhs);
- 
- 
-   //---------------------------------------------------------------------------
-   // Empty destructor is fine.
-   
-   ~FieldEngine() { }
- 
- 
-   //---------------------------------------------------------------------------
-   // Return the vertex centers. 
-   
-   typedef Array<Dim, PointType_t, EngineTag_t> VertexPositionsArray_t;
- 
-   const VertexPositionsArray_t &vertexPositions() const
-     {
-       return positions_m;
-     }
-   
- private:
- 
-   VertexPositionsArray_t positions_m;
- 
- };
- 
- template<int Dim, class TM, class CoordinateSystem, class T, class EngineTag,
-   class Tag>
- struct LeafFunctor<
-   FieldEngine<Lagrangian<Dim, TM, CoordinateSystem>, T, EngineTag>, 
-   ExpressionApply<Tag> >
- {
-   typedef Lagrangian<Dim, TM, CoordinateSystem> GeometryTag_t;
-   typedef FieldEngine<GeometryTag_t, T, EngineTag> Subject_t;
-   typedef typename Subject_t::Engine_t Engine_t;
-   typedef LeafFunctor<Engine_t, ExpressionApply<Tag> > LeafFunctor_t;
-   typedef int Type_t;
- 
-   inline static
-   Type_t apply(const Subject_t &fieldEngine, const ExpressionApply<Tag> &tag)
-   {
-     forEach(fieldEngine.vertexPositions(), tag, NullCombine());
-     
-     return LeafFunctor_t::apply(fieldEngine.engine(), tag);
-   }
- };
- 
- #endif // POOMA_FIELD_FIELDENGINE_LAGRANGIAN_H
- 
- // ACL:rcsinfo
- // ----------------------------------------------------------------------
- // $RCSfile: FieldEngine.Lagrangian.h,v $   $Author: oldham $
- // $Revision: 1.1 $   $Date: 2001/08/30 01:15:10 $
- // ----------------------------------------------------------------------
- // ACL:rcsinfo
- 
--- 0 ----
Index: FieldEngine.NoGeometry.h
===================================================================
RCS file: FieldEngine.NoGeometry.h
diff -N FieldEngine.NoGeometry.h
*** /tmp/cvsbKOjVk	Thu Sep 20 12:08:14 2001
--- /dev/null	Fri Mar 23 21:37:44 2001
***************
*** 1,348 ****
- // -*- C++ -*-
- // ACL:license
- // ----------------------------------------------------------------------
- // This software and ancillary information (herein called "SOFTWARE")
- // called POOMA (Parallel Object-Oriented Methods and Applications) is
- // made available under the terms described here.  The SOFTWARE has been
- // approved for release with associated LA-CC Number LA-CC-98-65.
- // 
- // Unless otherwise indicated, this SOFTWARE has been authored by an
- // employee or employees of the University of California, operator of the
- // Los Alamos National Laboratory under Contract No. W-7405-ENG-36 with
- // the U.S. Department of Energy.  The U.S. Government has rights to use,
- // reproduce, and distribute this SOFTWARE. The public may copy, distribute,
- // prepare derivative works and publicly display this SOFTWARE without 
- // charge, provided that this Notice and any statement of authorship are 
- // reproduced on all copies.  Neither the Government nor the University 
- // makes any warranty, express or implied, or assumes any liability or 
- // responsibility for the use of this SOFTWARE.
- // 
- // If SOFTWARE is modified to produce derivative works, such modified
- // SOFTWARE should be clearly marked, so as not to confuse it with the
- // version available from LANL.
- // 
- // For more information about POOMA, send e-mail to pooma at acl.lanl.gov,
- // or visit the POOMA web page at http://www.acl.lanl.gov/pooma/.
- // ----------------------------------------------------------------------
- // ACL:license
- 
- //-----------------------------------------------------------------------------
- // Classes: 
- //   NoGeometry<Dim>
- //   FieldEngine<NoGeometry, T, EngineTag>
- //-----------------------------------------------------------------------------
- 
- #ifndef POOMA_FIELD_FIELDENGINE_NOGEOMETRY_H
- #define POOMA_FIELD_FIELDENGINE_NOGEOMETRY_H
- 
- //-----------------------------------------------------------------------------
- // Overview: 
- // 
- // FieldEngine<NoGeometry, T, EngineTag>
- //-----------------------------------------------------------------------------
- 
- //-----------------------------------------------------------------------------
- // Includes:
- //-----------------------------------------------------------------------------
- #include "Field/FieldEngine/FieldEngineBase.h"
- 
- #include "Array/Array.h"
- #include "Domain/Interval.h"
- #include "Engine/ConstantFunctionEngine.h"
- #include "Engine/IndexFunctionEngine.h"
- #include "Layout/INode.h"
- #include "Field/Updater/UpdaterList.h"
- #include "Tiny/Vector.h"
- #include "Utilities/PAssert.h"
- 
- 
- //-----------------------------------------------------------------------------
- // Forward Declarations:
- //-----------------------------------------------------------------------------
- 
- template<class Components> class ComponentWrapper;
- template<int Dim, class T, class EngineTag> class Engine;
- template<class GeometryTag, class T, class EngineTag> class FieldEngine;
- 
- 
- //-----------------------------------------------------------------------------
- // NoGeometry tag class.
- //-----------------------------------------------------------------------------
- 
- template<int Dim>
- struct NoGeometry;
- 
- 
- //-----------------------------------------------------------------------------
- // FieldEngine, specialized for no geometry. This is really just a field
- // wrapper of a single engine.
- //-----------------------------------------------------------------------------
- 
- template<int Dim, class T, class EngineTag>
- class FieldEngine<NoGeometry<Dim>, T, EngineTag>
- {
- public:
- 
-   //---------------------------------------------------------------------------
-   // Exported typedefs and enumerations.
- 
-   // This class.
-   
-   typedef FieldEngine<NoGeometry<Dim>, T, EngineTag> This_t;
-     
-   // Our base class.
-   
-   typedef FieldEngineBase<Dim, T, EngineTag> Base_t;
- 
-   // The geometry tag.
-   
-   typedef NoGeometry<Dim> GeometryTag_t;
-   
-   // The engine tag.
-   
-   typedef EngineTag EngineTag_t;
-     
-   // The domain type.
-   
-   typedef typename Base_t::Domain_t Domain_t;
-   
-   // The number of indices required to select a point in this mesh.
-   
-   enum { dimensions = Dim };
-   
-   // Our engine type.
-   
-   typedef Engine<Dim, T, EngineTag> Engine_t;
-   
-   // Our layout type.
-   
-   typedef typename Engine_t::Layout_t Layout_t;
-   
-   // Our guard layers type.
-   
-   typedef GuardLayers<Dim> GuardLayers_t;
- 
- 
-   //---------------------------------------------------------------------------
-   // Constructors.
-   //
-   // There is no sub-field constructor because this field-engine can't have
-   // subfields.
- 
-   // Default constructor.
-   FieldEngine()
-   : engine_m(Pooma::NoInit()),
-     guards_m(0),
-     updaters_m()
-     { }
- 
-   // Copy constructor.
-   
-   FieldEngine(const This_t &model)
-   : engine_m(model.engine_m),
-     guards_m(model.guards_m),
-     updaters_m(model.updaters_m)
-     { }
- 
-   // Domain view constructor, including INodes and non-interval
-   // views. 
- 
-   template<class G2, class T2, class ET2, class Domain>  
-   FieldEngine(const FieldEngine<G2, T2, ET2> &model, 
-     const Domain &d)
-   : engine_m(NewEngineEngine<typename 
-       FieldEngine<G2, T2, ET2>::Engine_t, Domain>::apply(model.engine(), d), 
-              NewEngineDomain<typename
-       FieldEngine<G2, T2, ET2>::Engine_t, Domain>::apply(model.engine(), d)),
-     updaters_m(model.updaters())
-     { }
-     
-   // Sub-field constructor. Needs to exist, but shouldn't be called since we
-   // have no subfields.
-   
-   template<class G2, class T2, class ET2>  
-   FieldEngine(const FieldEngine<G2, T2, ET2> &model, const int &)
-   : engine_m(model.engine())
-     {
-       PError("Can't create a sub-field of a FieldEngine<NoGeometry,...>.");
-     }
- 
-   // Expression-engine constructor.    
- 
-   FieldEngine(const Engine<Dim, T, EngineTag> &e)
-   : engine_m(e)
-     {
-     }
- 
-   // Patch constructor.    
- 
-   template<class ET2>
-   FieldEngine(const FieldEngine<GeometryTag_t, T, ET2> &model, 
-               const FieldEnginePatch<Dim> &p)
-   : engine_m(engineFunctor(model.engine(), p)),
-     updaters_m(model.updaters())
-     { }
-     
-   // ComponentView constructor. The geometry for the model should be the
-   // same since a component view simply mutates the elements.
- 
-   template<class T2, class ET2, class Components>  
-   FieldEngine(const FieldEngine<GeometryTag_t, T2, ET2> &model, 
-     const ComponentWrapper<Components> &c)
-   : engine_m(model.engine(), c.components()),
-     updaters_m(model.updaters())
-     { }
- 
-   // EngineView version used for remote computations.
- 
-   template<class G2, class T2, class ET2, class Tag>  
-   FieldEngine(const FieldEngine<G2, T2, ET2> &model, 
- 	      const EngineView<Tag> &engineView)
-     : engine_m(leafFunctor(model.engine(), engineView)),
-     updaters_m(model.updaters())
-   { }
-     
-   //---------------------------------------------------------------------------
-   // Copy assignment operator (disabled).
-   
-   This_t &operator=(const This_t &rhs);
- 
- 
-   //---------------------------------------------------------------------------
-   // Empty destructor is fine.
-   
-   ~FieldEngine() { }
-       
- 
-   //---------------------------------------------------------------------------
-   // Accessors and modifiers.
-     
-   inline int numSubFields() const
-     {
-       return 0;
-     }
- 
-   const Loc<Dim> offsets() const
-     {
-       // Always vert-centered...
-       
-       return Loc<Dim>(1); 
-     }
-     
-   Engine_t &engine()
-     {
-       return engine_m;
-     }
-     
-   const Engine_t &engine() const
-     {
-       return engine_m;
-     }
- 
-   const UpdaterList &updaters() const
-     {
-       return updaters_m;
-     }
- 
-   UpdaterList &updaters()
-     {
-       return updaters_m;
-     }
-     
-   const GuardLayers_t &guardLayers() const
-     {
-       return guards_m;
-     }
- 
- 
-   //---------------------------------------------------------------------------
-   // Domain accessor functions.
-   //
-   // This field-engine always has vert-centering and the total domain is
-   // given by the engine.
-         
-   inline const Domain_t physicalCellDomain() const
-     {
-       return shrinkRight(physicalDomain(), 1);
-     }
-         
-   inline Domain_t totalCellDomain() const
-     {
-       return shrinkRight(engine_m.domain(), 1);
-     }
- 
-   Domain_t physicalDomain() const
-     {
-       return shrink(engine_m.domain(), guards_m);
-     }
- 
-   Domain_t totalDomain() const
-     {
-       return engine_m.domain();
-     }
- 
-   Domain_t physicalDomain(int iSubField) const
-     {
-       // This field engine cannot have subfields.
-       PAssert(iSubField == 0);
-       return physicalDomain();
-     }
- 
-   Domain_t totalDomain(int iSubField) const
-     {
-       // This field engine cannot have subfields.
-       PAssert(iSubField == 0);
-       return engine_m.domain();
-     }
- 
- 
-   //---------------------------------------------------------------------------
-   // Make a distinct copy of this fieldEngineBase.   
-  
-   template<class Subject>
-   void makeOwnCopy(const Subject &s)
-     {
-       // Deepen the copies of the engine & updaters list.
-       
-       engine().makeOwnCopy();
-       updaters().makeOwnCopy(s);
-     }
-   
- private:
- 
-   Engine_t engine_m;
-   GuardLayers_t guards_m;
-   UpdaterList updaters_m;
- };
- 
- // This version of field engine requires a specialization of ExpressionApply,
- // since the default version assume a field engine that uses FieldEngineBase.
- 
- template<int Dim, class T, class EngineTag, class Tag>
- struct LeafFunctor<
-   FieldEngine<NoGeometry<Dim>, T, EngineTag>, 
-   ExpressionApply<Tag> >
- {
-   typedef NoGeometry<Dim> GeometryTag_t;
-   typedef FieldEngine<GeometryTag_t, T, EngineTag> Subject_t;
-   typedef typename Subject_t::Engine_t Engine_t;
-   typedef LeafFunctor<Engine_t, ExpressionApply<Tag> > LeafFunctor_t;
-   typedef int Type_t;
- 
-   inline static
-   Type_t apply(const Subject_t &fieldEngine, const ExpressionApply<Tag> &tag)
-   {
-     return LeafFunctor_t::apply(fieldEngine.engine(), tag);
-   }
- };
- 
- 
- #endif // POOMA_FIELD_FIELDENGINE_NOGEOMETRY_H
- 
- // ACL:rcsinfo
- // ----------------------------------------------------------------------
- // $RCSfile: FieldEngine.NoGeometry.h,v $   $Author: oldham $
- // $Revision: 1.1 $   $Date: 2001/08/30 01:15:10 $
- // ----------------------------------------------------------------------
- // ACL:rcsinfo
- 
--- 0 ----
Index: FieldEngine.UR.h
===================================================================
RCS file: FieldEngine.UR.h
diff -N FieldEngine.UR.h
*** /tmp/cvs4HJ4r3	Thu Sep 20 12:08:14 2001
--- /dev/null	Fri Mar 23 21:37:44 2001
***************
*** 1,377 ****
- // -*- C++ -*-
- // ACL:license
- // ----------------------------------------------------------------------
- // This software and ancillary information (herein called "SOFTWARE")
- // called POOMA (Parallel Object-Oriented Methods and Applications) is
- // made available under the terms described here.  The SOFTWARE has been
- // approved for release with associated LA-CC Number LA-CC-98-65.
- // 
- // Unless otherwise indicated, this SOFTWARE has been authored by an
- // employee or employees of the University of California, operator of the
- // Los Alamos National Laboratory under Contract No. W-7405-ENG-36 with
- // the U.S. Department of Energy.  The U.S. Government has rights to use,
- // reproduce, and distribute this SOFTWARE. The public may copy, distribute,
- // prepare derivative works and publicly display this SOFTWARE without 
- // charge, provided that this Notice and any statement of authorship are 
- // reproduced on all copies.  Neither the Government nor the University 
- // makes any warranty, express or implied, or assumes any liability or 
- // responsibility for the use of this SOFTWARE.
- // 
- // If SOFTWARE is modified to produce derivative works, such modified
- // SOFTWARE should be clearly marked, so as not to confuse it with the
- // version available from LANL.
- // 
- // For more information about POOMA, send e-mail to pooma at acl.lanl.gov,
- // or visit the POOMA web page at http://www.acl.lanl.gov/pooma/.
- // ----------------------------------------------------------------------
- // ACL:license
- 
- //-----------------------------------------------------------------------------
- // Classes: 
- //   UniformRectilinear<Dim, TM, CoordinateSystem>
- //   FieldEngine<UniformRectilinear, T, EngineTag>
- //-----------------------------------------------------------------------------
- 
- #ifndef POOMA_FIELD_FIELDENGINE_UR_H
- #define POOMA_FIELD_FIELDENGINE_UR_H
- 
- //-----------------------------------------------------------------------------
- // Overview: 
- // 
- // FieldEngine<UniformRectilinear, T, EngineTag>
- //-----------------------------------------------------------------------------
- 
- //-----------------------------------------------------------------------------
- // Includes:
- //-----------------------------------------------------------------------------
- 
- #include "Field/FieldEngine/FieldEngineBase.h"
- 
- #include "Array/Array.h"
- #include "CoordinateSystems/Cartesian.h"
- #include "Domain/Interval.h"
- #include "Engine/ConstantFunctionEngine.h"
- #include "Engine/IndexFunctionEngine.h"
- #include "Layout/INode.h"
- #include "Tiny/Vector.h"
- #include "Utilities/PAssert.h"
- 
- 
- //-----------------------------------------------------------------------------
- // Forward Declarations:
- //-----------------------------------------------------------------------------
- 
- template<class GeometryTag, class T, class EngineTag> class FieldEngine;
- template<class Components> class ComponentWrapper;
- 
- 
- //-----------------------------------------------------------------------------
- // Full Description:
- // 
- // UniformRectilinear tag class.
- //-----------------------------------------------------------------------------
- 
- template<int Dim, class T = POOMA_DEFAULT_POSITION_TYPE,
-   class CoordinateSystem = Cartesian<Dim> >
- struct UniformRectilinear;
- 
- 
- //-----------------------------------------------------------------------------
- // Full Description:
- // 
- // FieldEngine, specialized for uniform rectilinear meshes.
- //-----------------------------------------------------------------------------
- 
- template<int Dim, class TM, class CoordinateSystem, class T, class EngineTag>
- class FieldEngine<UniformRectilinear<Dim, TM, CoordinateSystem>, T, EngineTag>
- : public FieldEngineBase<Dim, T, EngineTag>
- {
- public:
- 
-   //---------------------------------------------------------------------------
-   // Exported typedefs and enumerations.
- 
-   // This class.
-   
-   typedef 
-     FieldEngine<UniformRectilinear<Dim, TM, CoordinateSystem>, T, EngineTag>
-       This_t;
-     
-   // Our base class.
-   
-   typedef FieldEngineBase<Dim, T, EngineTag> Base_t;
- 
-   // The geometry tag.
-   
-   typedef UniformRectilinear<Dim, TM, CoordinateSystem> GeometryTag_t;
-   
-   // The engine tag.
-   
-   typedef EngineTag EngineTag_t;
-   
-   // The coordinate system.
-   
-   typedef CoordinateSystem CoordinateSystem_t;
-   
-   // The domain type.
-   
-   typedef typename Base_t::Domain_t Domain_t;
-   
-   // The number of indices required to select a point in this mesh.
-   
-   enum { dimensions = Dim };
-   
-   // The type used to represent a point in the mesh.
-   
-   typedef Vector<Dim, TM> PointType_t;
-   
-   // Our engine type.
-   
-   typedef Engine<Dim, T, EngineTag> Engine_t;
-   
-   // Our layout type.
-   
-   typedef typename Engine_t::Layout_t Layout_t;
- 
- 
-   //---------------------------------------------------------------------------
-   // Constructors. We don't use default arguments for the origin and spacings
-   // because that produces ambiguities.
- 
-   FieldEngine()
-   : Base_t()
-     { }
- 
-   template<class BaseInitializer>  
-   FieldEngine(const BaseInitializer &baseInit, 
-     const Layout_t &layout,
-     const PointType_t &origin,
-     const PointType_t &spacings)
-   : Base_t(baseInit, layout),
-     origin_m(origin),
-     spacings_m(spacings)
-     { }
- 
-   // Version that constructs a field with a new centering but based on the
-   // same geometry.
- 
-   template<class BaseInitializer, class T2, class ET2>  
-   FieldEngine(const BaseInitializer &baseInit,
- 	      const FieldEngine<GeometryTag_t, T2, ET2> &model)
-   : Base_t(baseInit, model),
-     origin_m(model.origin()),
-     spacings_m(model.spacings())
-     {
-     }
-     
-   // Copy constructor.
-   
-   FieldEngine(const This_t &model)
-   : Base_t(model),
-     origin_m(model.origin_m),
-     spacings_m(model.spacings_m)
-     { }
-     
-   // Copy constructor (except for updaters).
- 
-   FieldEngine(const This_t &model, const Pooma::Updaters::DontCopyUpdaters &d)
-   : Base_t(model, d),
-     origin_m(model.origin_m),
-     spacings_m(model.spacings_m)
-     { }
-     
-   // Sub-field constructor.
- 
-   template<class ET2>  
-   FieldEngine(const FieldEngine<GeometryTag_t, T, ET2> &model, 
-     const int &iSubField)
-   : Base_t(model, iSubField),
-     origin_m(model.origin()),
-     spacings_m(model.spacings())
-     { }
- 
-   // Domain view constructor.
- 
-   template<class T2, class ET2>  
-   FieldEngine(const FieldEngine<GeometryTag_t, T2, ET2> &model, 
-     const Domain_t &d)
-   : Base_t(model, d),
-     origin_m(model.origin()),
-     spacings_m(model.spacings())
-     {
-       for (int i = 0; i < Dim; i++)
-         origin_m(i) += 
-           (d[i].first() - model.physicalCellDomain()[i].first()) *
-           spacings_m(i);
-     }
- 
-   template<class T2, class ET2>  
-   FieldEngine(const FieldEngine<GeometryTag_t, T2, ET2> &model, 
-     const INode<Dim> &inode)
-   : Base_t(model, inode),
-     origin_m(model.origin()),
-     spacings_m(model.spacings())
-     {
-       for (int i = 0; i < Dim; i++)
-         origin_m(i) += 
-           (inode.domain()[i].first() - model.physicalCellDomain()[i].first()) *
-           spacings_m(i);
-     }
- 
-   template<class T2, class ET2, class Tag>  
-   FieldEngine(const FieldEngine<GeometryTag_t, T2, ET2> &model, 
- 	      const EngineView<Tag> &engineView)
-   : Base_t(model, engineView),
-     origin_m(model.origin()),
-     spacings_m(model.spacings())
-   {
-     // Will need to fix up origin_m if EnginView replaces INode<> view.
-   }
- 
-   // Expression-engine constructor.    
- 
-   FieldEngine(const Engine<Dim, T, EngineTag> &e)
-   : Base_t(e)
-     {
-       origin_m = referenceField().fieldEngine().origin(); 
-       spacings_m = referenceField().fieldEngine().spacings(); 
-     }
- 
-   // Patch constructor.    
- 
-   template<class ET2>
-   FieldEngine(const FieldEngine<GeometryTag_t, T, ET2> &model, 
-               const FieldEnginePatch<Dim> &p)
-   : Base_t(model, p),
-     spacings_m(model.spacings())
-     { 
-       for (int i = 0; i < Dim; i++)
-         origin_m(i) += 
-           (physicalCellDomain()[i].first() - 
-           model.physicalCellDomain()[i].first()) *
-           spacings_m(i);
-     }
-     
-   // ComponentView constructor. The geometry for the model should be the
-   // same since a component view simply mutates the elements.
- 
-   template<class T2, class ET2, class Components>  
-   FieldEngine(const FieldEngine<GeometryTag_t, T2, ET2> &model, 
-     const ComponentWrapper<Components> &c)
-   : Base_t(model, c),
-     origin_m(model.origin()),
-     spacings_m(model.spacings())
-     { }
- 
- 
-   //---------------------------------------------------------------------------
-   // Copy assignment operator (shallow).
-   
-   This_t &operator=(const This_t &rhs)
-   {
-     origin_m = rhs.origin();
-     spacings_m = rhs.spacings();
-     initialize(rhs);
-     return *this;
-   }
- 
-   //---------------------------------------------------------------------------
-   // Empty destructor is fine.
-   
-   ~FieldEngine() { }
- 
- 
-   //---------------------------------------------------------------------------
-   // Accessors.
-   
-   inline const PointType_t &origin() const { return origin_m; }
-   inline const PointType_t &spacings() const { return spacings_m; }
- 
- 
-   //---------------------------------------------------------------------------
-   // Return an index-function-engine-based array that can return the positions
-   // of the geometric center of a cell's faces. 
-   
-   class FaceCenterFunctor
-   {
-     public:
-     
-       FaceCenterFunctor() { }
-       
-       FaceCenterFunctor(const PointType_t &origin, const PointType_t &spacings,
-                         const Domain_t &pcd, int orientation)
-       : origin_m(origin), spacings_m(spacings)
-         {
-           for (int i = 0; i < PointType_t::dimensions; i++)
-             {
-               if (i != orientation)
-                 origin_m(i) += 0.5 * spacings_m(i);
-               origin_m(i) -= pcd[i].first() * spacings_m(i);
-             }
-         }
-       
-       PointType_t operator()(int i0) const
-         {
-           return origin_m + PointType_t(i0) * spacings_m;
-         }
-       
-       PointType_t operator()(int i0, int i1) const
-         {
-           return origin_m + PointType_t(i0, i1) * spacings_m;
-         }
- 
-         PointType_t operator()(int i0, int i1, int i2) const
-         {
-           return origin_m + PointType_t(i0, i1, i3) * spacings_m;
-         }
- 
-     private:
-     
-       PointType_t origin_m, spacings_m;
-   };
-     
-   typedef Array<Dim, PointType_t, IndexFunction<FaceCenterFunctor> > 
-     FaceCentersArray_t;
- 
-   FaceCentersArray_t faceCenters(int orientation, const Domain_t &d) const;
-   
- private:
- 
-   PointType_t origin_m, spacings_m;
- 
- };
- 
- 
- ///////////////////////////////////////////////////////////////////////////////
- //
- // Non-inline members.
- //
- ///////////////////////////////////////////////////////////////////////////////
- 
- //-----------------------------------------------------------------------------
- // Return the face centers.
- //-----------------------------------------------------------------------------
- 
- template <int Dim, class TM, class CoordinateSystem, class T, class EngineTag>
- typename 
-   FieldEngine<UniformRectilinear<Dim, TM, CoordinateSystem>, T, EngineTag>::
-     FaceCentersArray_t 
- FieldEngine<UniformRectilinear<Dim, TM, CoordinateSystem>, T, EngineTag>::
- faceCenters(int orientation, const Domain_t &d) const
- {
-   FaceCentersArray_t array(d);
-   FaceCenterFunctor functor(origin_m, spacings_m, physicalCellDomain(),
-     orientation);
-   array.engine().setFunctor(functor);
-   return array;
- }
- 
- #endif // POOMA_FIELD_FIELDENGINE_UR_H
- 
- // ACL:rcsinfo
- // ----------------------------------------------------------------------
- // $RCSfile: FieldEngine.UR.h,v $   $Author: oldham $
- // $Revision: 1.1 $   $Date: 2001/08/30 01:15:10 $
- // ----------------------------------------------------------------------
- // ACL:rcsinfo
- 
--- 0 ----
Index: FieldEngineApply.h
===================================================================
RCS file: FieldEngineApply.h
diff -N FieldEngineApply.h
*** /tmp/cvsALibZL	Thu Sep 20 12:08:14 2001
--- /dev/null	Fri Mar 23 21:37:44 2001
***************
*** 1,34 ****
- 
- 
- template<class Geometry, class T, class E, class Tag>
- struct LeafFunctor<Field<Geometry, T, E>, EngineApply<Tag> >
- {
-   typedef Field<Geometry, T, E> Subject_t;
-   typedef typename Subject_t::FieldEngine_t FieldEngine_t;
-   typedef LeafFunctor<FieldEngine_t, EngineApply<Tag> > LeafFunctor_t;
-   typedef typename LeafFunctor_t::Type_t Type_t;
- 
-   inline static
-   Type_t apply(const Subject_t &field, 
- 	       const EngineApply<Tag> &tag)
-     {
-       return LeafFunctor_t::apply(field.fieldEngine(), tag);
-     }
- };
- 
- template<class Geometry, class T, class E, class Tag>
- struct LeafFunctor<FieldEngine<Geometry, T, E>, EngineApply<Tag> >
- {
-   typedef FieldEngine<Geometry, T, E> Subject_t;
-   typedef typename Subject_t::Engine_t Engine_t;
-   typedef LeafFunctor<Engine_t, EngineApply<Tag> > LeafFunctor_t;
-   typedef typename LeafFunctor_t::Type_t Type_t;
- 
-   inline static
-   Type_t apply(const Subject_t &fieldEngine, 
- 	       const EngineApply<Tag> &tag)
-     {
-       return LeafFunctor_t::apply(fieldEngine.engine(), tag);
-     }
- };
- 
--- 0 ----
Index: FieldEngineBase.h
===================================================================
RCS file: FieldEngineBase.h
diff -N FieldEngineBase.h
*** /tmp/cvsu3ikwu	Thu Sep 20 12:08:14 2001
--- /dev/null	Fri Mar 23 21:37:44 2001
***************
*** 1,589 ****
- // -*- C++ -*-
- // ACL:license
- // ----------------------------------------------------------------------
- // This software and ancillary information (herein called "SOFTWARE")
- // called POOMA (Parallel Object-Oriented Methods and Applications) is
- // made available under the terms described here.  The SOFTWARE has been
- // approved for release with associated LA-CC Number LA-CC-98-65.
- // 
- // Unless otherwise indicated, this SOFTWARE has been authored by an
- // employee or employees of the University of California, operator of the
- // Los Alamos National Laboratory under Contract No. W-7405-ENG-36 with
- // the U.S. Department of Energy.  The U.S. Government has rights to use,
- // reproduce, and distribute this SOFTWARE. The public may copy, distribute,
- // prepare derivative works and publicly display this SOFTWARE without 
- // charge, provided that this Notice and any statement of authorship are 
- // reproduced on all copies.  Neither the Government nor the University 
- // makes any warranty, express or implied, or assumes any liability or 
- // responsibility for the use of this SOFTWARE.
- // 
- // If SOFTWARE is modified to produce derivative works, such modified
- // SOFTWARE should be clearly marked, so as not to confuse it with the
- // version available from LANL.
- // 
- // For more information about POOMA, send e-mail to pooma at acl.lanl.gov,
- // or visit the POOMA web page at http://www.acl.lanl.gov/pooma/.
- // ----------------------------------------------------------------------
- // ACL:license
- 
- //-----------------------------------------------------------------------------
- // Classes: 
- //   FieldEngineBase
- //-----------------------------------------------------------------------------
- 
- #ifndef POOMA_FIELD_FIELDENGINE_FIELDENGINEBASE_H
- #define POOMA_FIELD_FIELDENGINE_FIELDENGINEBASE_H
- 
- //-----------------------------------------------------------------------------
- // Overview: 
- // 
- // FieldEngineBase and related classes. POOMA supports a flexible form 
- // of "centering" that allows a hierarchy of multiple centering points per 
- // cell. The centering information, managed by the FieldEngineBase
- // class, is initialized using a flexible set of functors.
- //-----------------------------------------------------------------------------
- 
- //-----------------------------------------------------------------------------
- // Includes:
- //-----------------------------------------------------------------------------
- 
- #include "Domain/Interval.h"
- #include "Domain/Loc.h"
- #include "Domain/Shrink.h"
- #include "Layout/INode.h"
- #include "Layout/GuardLayers.h"
- #include "Utilities/PAssert.h"
- #include "Utilities/RefCountedBlockPtr.h"
- #include "Engine/EnginePatch.h"
- #include "Engine/EngineFunctor.h"
- #include "Field/Updater/UpdaterList.h"
- #include "Field/FieldEngine/FieldEnginePatch.h"
- 
- //-----------------------------------------------------------------------------
- // Forward declarations:
- //-----------------------------------------------------------------------------
- 
- template<int Dim, class T, class EngineTag> class Engine;
- template<class Components> class ComponentWrapper;
- 
- 
- // ----------------------------------------------------------------------------
- // FieldEngineBaseData holds offset information about the centering along
- // with a copy of the engine containing the data associated with the centering.
- // ----------------------------------------------------------------------------
- 
- template <int Dim, class T, class EngineTag>
- class FieldEngineBaseData : public RefCounted
- {
- public:
- 
-   template<class Initializer>
-   FieldEngineBaseData(const Loc<Dim> &offsets, 
-                       const Initializer &init)
-     : offsets_m(offsets), 
-       engine_m(init)
-     { }
- 
-   template<class Initializer>
-   FieldEngineBaseData(const Loc<Dim> &offsets, 
-                       const Initializer &init, const UpdaterList &l)
-     : offsets_m(offsets), 
-       engine_m(init),
-       updaters_m(l)
-     { }
- 
-   template<class Engine, class Domain>
-   FieldEngineBaseData(const Loc<Dim> &offsets, const Engine &e,
-     const Domain &d, const UpdaterList &l)
-     : offsets_m(offsets), 
-       engine_m(NewEngineEngine<Engine, Domain>::apply(e, d), 
-                NewEngineDomain<Engine, Domain>::apply(e, d)),
-       updaters_m(l)
-     { }
-     
-   const Loc<Dim> &offsets() const { return offsets_m; }
- 
-   const Engine<Dim, T, EngineTag> &engine() const { return engine_m; }
-   Engine<Dim, T, EngineTag> &engine() { return engine_m; }
- 
-   const UpdaterList &updaters() const { return updaters_m; }
-   UpdaterList &updaters() { return updaters_m; }
-   
- private:
- 
-   Loc<Dim> offsets_m;
-   Engine<Dim, T, EngineTag> engine_m;
-   UpdaterList updaters_m;
- };
- 
- 
- // ----------------------------------------------------------------------------
- // FieldEngineBase manages a hierarchy of engines, making it possible for
- // FieldEngine specializations to implement geometry-specific behavior only.
- // ----------------------------------------------------------------------------
- 
- template<int Dim, class T, class EngineTag>
- class FieldEngineBase
- {
- public:
- 
-   //---------------------------------------------------------------------------
-   // Exported typedefs and enumerations.
-     
-   typedef FieldEngineBase<Dim, T, EngineTag> This_t;
-   typedef FieldEngineBaseData<Dim, T, EngineTag> Data_t;
-   typedef Engine<Dim, T, EngineTag> Engine_t;
-   typedef typename Engine_t::Domain_t Domain_t;
-   typedef typename Engine_t::Layout_t Layout_t;
-   typedef typename Engine_t::Element_t Element_t;
-   typedef typename Engine_t::ElementRef_t ElementRef_t;
-   enum { dimensions = Dim };
-   typedef GuardLayers<Dim> GuardLayers_t;
- 
- 
-   //---------------------------------------------------------------------------
-   // Constructors.
- 
-   // Default constructor.
-   
-   FieldEngineBase()
-   : physicalCellDomain_m(Pooma::NoInit()),
-     guards_m(0)
-     { }
-   
-   // Layout constructor. Takes a layout appropriate for the contained
-   // engines and, based on the logic contained in the InitFunctor, sets
-   // up centering information and the engines.
-     
-   template<class InitFunctor>
-   FieldEngineBase(const InitFunctor &f, const Layout_t &layout)
-   : physicalCellDomain_m(layout.domain()),
-     guards_m(layout.externalGuards())
-     {
-       shrinkInPlace(physicalCellDomain_m, guards_m);
-       shrinkRightInPlace(physicalCellDomain_m, 1);
-       f.initialize(*this, layout);
-     }
- 
-   // Initialize with a new centering from a model.
- 
-   template<class InitFunctor, class T2, class ET2>
-   FieldEngineBase(const InitFunctor &f,
- 		  const FieldEngineBase<Dim, T2, ET2> &model)
-   : physicalCellDomain_m(model.physicalCellDomain()),
-     guards_m(model.guardLayers())
-     {
-       f.initialize(*this, Pooma::NoInit());
-     }
- 
-   // Copy constructor.
-   
-   FieldEngineBase(const This_t &model)
-   : subFields_m(model.subFields_m),
-     data_m(model.data_m),
-     physicalCellDomain_m(model.physicalCellDomain_m),
-     guards_m(model.guards_m)
-     { }
- 
-   // Sub-field view constructor. This is when we want to construct a view of
-   // one of the subFields in our top-level list.
-   
-   FieldEngineBase(const This_t &model, const int &iSubField)
-   : subFields_m(model.subFields_m[iSubField].subFields_m),
-     data_m(model.subFields_m[iSubField].data_m),
-     physicalCellDomain_m(model.physicalCellDomain_m),
-     guards_m(model.guards_m)
-     { }  
- 
-   // View constructor.  
-   
-   template<int Dim2, class T2, class EngineTag2, class Initializer>
-   FieldEngineBase(const FieldEngineBase<Dim2, T2, EngineTag2> &model, 
-     const Initializer &i)
-     {
-       initialize(*this, model, i); 
-     }  
- 
-   //---------------------------------------------------------------------------
-   // Initialize functions. 
- 
-   template<class Initializer>
-   void initialize(const Loc<Dim> &loc, const Initializer &init)
-     {
-       data_m = new Data_t(loc, init);
-     }
- 
-   template<class Initializer>
-   void initialize(const Loc<Dim> &loc, const Initializer &init, 
-                   const UpdaterList &l)
-     {
-       data_m = new Data_t(loc, init, l);
-     }
- 
-   template<class Engine, class Domain>
-   void initialize(const Loc<Dim> &loc, const Engine &e, const Domain &d,
-     const UpdaterList &l)
-     {
-       data_m = new Data_t(loc, e, d, l);
-     }
- 
-   void initialize(const This_t &model)
-   {
-     subFields_m = model.subFields_m;
-     data_m = model.data_m;
-     physicalCellDomain_m = model.physicalCellDomain_m;
-     guards_m = model.guards_m;
-   }
- 
-   template<int Dim2, class T2, class EngineTag2>
-   void initialize(This_t &s, 
-     const FieldEngineBase<Dim2, T2, EngineTag2> &model, const Domain_t &d)
-     {
-       int n = model.numSubFields();
-       if (n == 0)
-         {
-           s.physicalCellDomain_m = shrinkRight(d - d.firsts(),
- 					       model.offsets());
-           s.initialize(model.offsets(), model.engine(), d, model.updaters());
-         }
-       else
-         {
-           s.physicalCellDomain_m = d - d.firsts();
-           s.addSubFields(n);
-           for (int i = 0; i < n; i++)
-             initialize(s.subFields_m[i], model.subField(i),
-               model.subField(i).translateDomain(d));
-         }
-     }
- 
-   template<int Dim2, class T2, class EngineTag2>
-   void initialize(This_t &s, 
-     const FieldEngineBase<Dim2, T2, EngineTag2> &model, const INode<Dim> &i)
-   {
-       int n = model.numSubFields();
-       if (n == 0)
-         {
- 	  s.physicalCellDomain_m = 
- 	    shrinkRight(i.domain() - i.domain().firsts(), model.offsets());
- 	  s.initialize(model.offsets(), model.engine(), i, model.updaters());
-         }
-       else
-         {
- 	  s.physicalCellDomain_m = i.domain() - i.domain().firsts();
- 	  s.addSubFields(n);
- 	  for (int j = 0; j < n; j++)
- 	    initialize(s.subFields_m[j], model.subField(j),
- 		       model.subField(j).translateDomain(i));
-         }
-   }
- 
-   template<int Dim2, class T2, class EngineTag2, class Tag>
-   void initialize(This_t &s, 
- 		  const FieldEngineBase<Dim2, T2, EngineTag2> &model,
- 		  const EngineView<Tag> &ev)
-   {
-     typedef typename FieldEngineBase<Dim2, T2, EngineTag2>::Engine_t EngIn_t;
-     int n = model.numSubFields();
-     if (n == 0)
-       {
-         s.physicalCellDomain_m = model.physicalCellDomain();
-         s.guards_m = model.guardLayers();
-         s.initialize(model.offsets(),
- 	    	     LeafFunctor<EngIn_t,
- 		     EngineView<Tag> >::apply(model.engine(), ev),
- 		     model.updaters());
-       }
-     else
-       {
-         s.physicalCellDomain_m = model.physicalCellDomain();
-         s.guards_m = model.guardLayers();
-         s.addSubFields(n);
-         for (int i = 0; i < n; i++)
- 	  initialize(s.subFields_m[i], model.subField(i), ev);
-       }
-   }
- 
-   template<class EngineTag2>
-   void initialize(This_t &s, 
-                   const FieldEngineBase<Dim, T, EngineTag2> &model,
-                   const FieldEnginePatch<Dim> &p)
-     {
-       PAssert(model.numSubFields() == 0);
-       s.initialize(model.offsets(), engineFunctor(model.engine(),
-                                                   EnginePatch(p.patch_m)));
-       s.physicalCellDomain_m = shrinkRight(p.domain_m, model.offsets());
-       s.guards_m = model.guardLayers();
-     }
- 
-   template<int Dim2, class T2, class EngineTag2, class Components>
-   void initialize(This_t &s, 
-     const FieldEngineBase<Dim2, T2, EngineTag2> &model, 
-     const ComponentWrapper<Components> &c)
-     {
-       int n = model.numSubFields();
-       if (n == 0)
-         {
-           s.physicalCellDomain_m = model.physicalCellDomain();
-           s.guards_m = model.guardLayers();
-           s.initialize(model.offsets(), 
-                        Engine_t(model.engine(), c.components()),
-                        model.updaters());
-         }
-       else
-         {
-           s.physicalCellDomain_m = model.physicalCellDomain();
-           s.guards_m = model.guardLayers();
-           s.addSubFields(n);
-           for (int i = 0; i < n; i++)
-             initialize(s.subFields_m[i], model.subField(i), c);
-         }
-     }
- 
-   void initialize(This_t &s, const This_t &model, 
-     const Pooma::Updaters::DontCopyUpdaters &d)
-     {
-       int n = model.numSubFields();
-       s.physicalCellDomain_m = model.physicalCellDomain();
-       s.guards_m = model.guardLayers();
-       if (n == 0)
-         {
-           s.initialize(model.offsets(), model.engine());
-         }
-       else
-         {
-           s.addSubFields(n);
-           for (int i = 0; i < n; i++)
-             initialize(s.subFields_m[i], model.subField(i), d);
-         }
-     }
-       
- 
-   //---------------------------------------------------------------------------
-   // Accessors and modifiers.
-     
-   void addSubFields(int n)
-     {
-       PAssert(subFields_m.size() == 0);
-       
-       subFields_m.reserve(n);
-       subFields_m.resize(n);
-       for (int i = 0; i < n; i++)
-         {
-           subFields_m[i].physicalCellDomain_m = physicalCellDomain_m;
-           subFields_m[i].guards_m = guards_m;
-         }
-     }
-     
-   inline int numSubFields() const
-     {
-       return subFields_m.size();
-     }
-     
-   This_t &subField(int i)
-     {
-       return subFields_m[i];
-     }
-     
-   const This_t &subField(int i) const
-     {
-       return subFields_m[i];
-     }
- 
-   const Loc<Dim> &offsets() const
-     {
-       PAssert(data_m.isValid());
-       return data_m->offsets();
-     }
-     
-   Engine_t &engine()
-     {
-       PAssert(data_m.isValid());
-       return data_m->engine();
-     }
-     
-   const Engine_t &engine() const
-     {
-       PAssert(data_m.isValid());
-       return data_m->engine();
-     }
- 
-   const UpdaterList &updaters() const
-     {
-       PAssert(data_m.isValid());
-       return data_m->updaters();
-     }
- 
-   UpdaterList &updaters()
-     {
-       PAssert(data_m.isValid());
-       return data_m->updaters();
-     }
-     
-   const GuardLayers_t &guardLayers() const
-     {
-       return guards_m;
-     }
- 
-   GuardLayers_t &guardLayers()
-     {
-       return guards_m;
-     }
- 
- 
-   //---------------------------------------------------------------------------
-   // Domain accessor functions. 
-         
-   inline const Domain_t physicalCellDomain() const
-     {
-       return physicalCellDomain_m;
-     }
-         
-   inline Domain_t totalCellDomain() const
-     {
-       return grow(physicalCellDomain_m, guards_m);
-     }
- 
-   Domain_t physicalDomain(int iSubField) const
-     {
-       return subFields_m[iSubField].
-         translateDomain(physicalCellDomain_m);
-     }
- 
-   Domain_t totalDomain(int iSubField) const
-     {
-       return subFields_m[iSubField].
-         translateDomain(totalCellDomain());
-     }
- 
-   Domain_t physicalDomain() const
-     {
-       return translateDomain(physicalCellDomain_m);
-     }
- 
-   Domain_t totalDomain() const
-     {
-       return translateDomain(totalCellDomain());
-     }
- 
-   
-   //---------------------------------------------------------------------------
-   // Make a distinct copy of this fieldEngineBase.   
-  
-   template<class Subject>
-   void makeOwnCopy(const Subject &s)
-     {
-       // This only make sense if we have no subfields.
-       
-       PAssert(data_m.isValid());
- 
-       // Create a new data block with shallow copies of the engine and the
-       // updaters.
-       
-       initialize(offsets(), engine(), updaters());
-       
-       // Deepen the copies of the engine & updaters list.
-       
-       engine().makeOwnCopy();
-       updaters().makeOwnCopy(s);
-     }
- 
- 
-   //---------------------------------------------------------------------------
-   // Domain translation function. 
-   
-   inline Domain_t
-   translateDomain(const Domain_t &d) const
-     {
-       if (subFields_m.size() == 0)
-         return growRight(d, offsets());
-       else
-         return d;
-     }
-   
-   inline INode<Dim>
-   translateDomain(const INode<Dim> &inode) const
-   {
-     return INode<Dim>(inode, translateDomain(inode.domain()));
-   }
-   
-   inline Domain_t
-   translateToVertexDomain(const Domain_t &d) const
-     {
-       if (subFields_m.size() == 0)
-         return d;
-       else
-         return growRight(d, 1);
-     }
- 
-       
- private:
- 
-   RefCountedBlockPtr<This_t> subFields_m;
-   RefCountedPtr<Data_t> data_m;
-   Domain_t physicalCellDomain_m;
-   GuardLayers_t guards_m;
- };
- 
- template<int Dim, class T, class EngineTag, class Tag>
- struct LeafFunctor<FieldEngineBase<Dim, T, EngineTag>,
-   ExpressionApply<Tag> >
- {
-   typedef FieldEngineBase<Dim, T, EngineTag> Subject_t;
-   typedef typename Subject_t::Engine_t Engine_t;
-   typedef LeafFunctor<Engine_t, ExpressionApply<Tag> > LeafFunctor_t;
-   typedef int Type_t;
- 
-   inline static
-   Type_t apply(const Subject_t &fieldEngineBase, 
- 	       const ExpressionApply<Tag> &tag)
-   {
-     int n = fieldEngineBase.numSubFields();
- 
-     if (n == 0)
-     {
-       LeafFunctor_t::apply(fieldEngineBase.engine(), tag);
-     }
-     else
-     {
-       int i;
-       for (i = 0; i < n; ++i)
-       {
- 	apply(fieldEngineBase.subField(i), tag);
-       }
-     }
-     return 0;
-   }
- };
- 
- // This function applies a generic thing to all the FieldEngineBase
- // objects that contain an engine.
- 
- template<int Dim, class T, class ETag, class Thing>
- void
- applyThingToFieldEngineBase(FieldEngineBase<Dim, T, ETag> &fieldEngineBase, 
- 			    const Thing &thing)
- {
-   int n = fieldEngineBase.numSubFields();
- 
-   if (n == 0)
-   {
-     thing(fieldEngineBase);
-   }
-   else
-   {
-     int i;
-     for (i = 0; i < n; ++i)
-     {
-       applyThingToFieldEngineBase(fieldEngineBase.subField(i), thing);
-     }
-   }
- }
- 
- #endif // POOMA_FIELD_FIELDENGINE_FIELDENGINEBASE_H
- 
- // ACL:rcsinfo
- // ----------------------------------------------------------------------
- // $RCSfile: FieldEngineBase.h,v $   $Author: oldham $
- // $Revision: 1.1 $   $Date: 2001/08/30 01:15:11 $
- // ----------------------------------------------------------------------
- // ACL:rcsinfo
--- 0 ----


More information about the pooma-dev mailing list