Index: src/Domain/Shrink.h =================================================================== RCS file: /home/pooma/Repository/r2/src/Domain/Shrink.h,v retrieving revision 1.7 diff -u -r1.7 Shrink.h --- src/Domain/Shrink.h 2000/07/25 01:08:39 1.7 +++ src/Domain/Shrink.h 2002/08/02 10:27:45 @@ -37,12 +37,15 @@ ////////////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// Overview: -// -// shrinkRight(Interval,Loc) returns an Interval which is -// Loc shorter in each direction. -//----------------------------------------------------------------------------- +/** @file + * @ingroup Domain + * @brief + * Interval shrinking and growing on either side by int or Loc. + * + * Examples: + * - shrinkRight(Interval<1>(0, 4), 1) == Interval<1>(0, 3) + * - growLeft(Interval<1>(0, 4), 1) == Interval<1>(-1, 4) + */ //----------------------------------------------------------------------------- // Typedefs: @@ -59,94 +62,126 @@ // Forward Declarations: //----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -// -// Full Description: -// -//----------------------------------------------------------------------------- +/// Shrinks the Interval dom from the right by s[i] in direction i. template -Interval & -shrinkRightInPlace(Interval &dom, const Loc &s) +inline Interval +shrinkRight(const Interval &dom, const Loc &s) { + Interval ret = Pooma::NoInit(); for (int d = 0; d < Dim; ++d) { int a = dom[d].first(); int b = dom[d].last() - s[d].first(); - dom[d] = Interval<1>(a, b); + ret[d] = Interval<1>(a, b); } - return dom; + return ret; } +/// Shrinks the Interval dom from the right by s in every direction. template -Interval & -shrinkRightInPlace(Interval &dom, int s) +inline Interval +shrinkRight(const Interval &dom, int s) { + Interval ret = Pooma::NoInit(); for (int d = 0; d < Dim; ++d) { int a = dom[d].first(); int b = dom[d].last() - s; - dom[d] = Interval<1>(a, b); + ret[d] = Interval<1>(a, b); } - return dom; + return ret; } +/// Grows the Interval dom to the right by s[i] in direction i. template -Interval & -growRightInPlace(Interval &dom, const Loc &s) +inline Interval +growRight(const Interval &dom, const Loc &s) { + Interval ret = Pooma::NoInit(); for (int d = 0; d < Dim; ++d) { int a = dom[d].first(); int b = dom[d].last() + s[d].first(); - dom[d] = Interval<1>(a, b); + ret[d] = Interval<1>(a, b); } - return dom; + return ret; } +/// Grows the Interval dom to the right by s in every direction. template -Interval & -growRightInPlace(Interval &dom, int s) +inline Interval +growRight(const Interval &dom, int s) { + Interval ret = Pooma::NoInit(); for (int d = 0; d < Dim; ++d) { int a = dom[d].first(); int b = dom[d].last() + s; - dom[d] = Interval<1>(a, b); + ret[d] = Interval<1>(a, b); } - return dom; + return ret; } + +/// Shrinks the Interval dom from the left by s[i] in direction i. template -inline Interval -shrinkRight(const Interval &dom, const Loc &s) +Interval +shrinkLeft(const Interval &dom, const Loc &s) { - Interval ret(dom); - return shrinkRightInPlace(ret, s); + Interval ret = Pooma::NoInit(); + for (int d = 0; d < Dim; ++d) + { + int a = dom[d].first() + s[d].first(); + int b = dom[d].last(); + ret[d] = Interval<1>(a, b); + } + return ret; } +/// Shrinks the Interval dom from the left by s in every direction. template -inline Interval -shrinkRight(const Interval &dom, int s) +Interval +shrinkLeft(const Interval &dom, int s) { - Interval ret(dom); - return shrinkRightInPlace(ret, s); + Interval ret = Pooma::NoInit(); + for (int d = 0; d < Dim; ++d) + { + int a = dom[d].first() + s; + int b = dom[d].last(); + ret[d] = Interval<1>(a, b); + } + return ret; } +/// Grows the Interval dom to the left by s[i] in direction i. template -inline Interval -growRight(const Interval &dom, const Loc &s) +Interval +growLeft(const Interval &dom, const Loc &s) { - Interval ret(dom); - return growRightInPlace(ret, s); + Interval ret = Pooma::NoInit(); + for (int d = 0; d < Dim; ++d) + { + int a = dom[d].first() - s[d].first(); + int b = dom[d].last(); + ret[d] = Interval<1>(a, b); + } + return ret; } +/// Grows the Interval dom to the left by s in every direction. template -inline Interval -growRight(const Interval &dom, int s) +Interval +growLeft(const Interval &dom, int s) { - Interval ret(dom); - return growRightInPlace(ret, s); + Interval ret = Pooma::NoInit(); + for (int d = 0; d < Dim; ++d) + { + int a = dom[d].first() - s; + int b = dom[d].last(); + ret[d] = Interval<1>(a, b); + } + return ret; } Index: src/Field/FieldEngine/FieldEngine.h =================================================================== RCS file: /home/pooma/Repository/r2/src/Field/FieldEngine/FieldEngine.h,v retrieving revision 1.3 diff -u -r1.3 FieldEngine.h --- src/Field/FieldEngine/FieldEngine.h 2002/07/01 22:25:53 1.3 +++ src/Field/FieldEngine/FieldEngine.h 2002/08/02 10:27:45 @@ -34,14 +34,16 @@ #ifndef POOMA_FIELD_FIELDENGINE_FIELDENGINE_H #define POOMA_FIELD_FIELDENGINE_FIELDENGINE_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. -//----------------------------------------------------------------------------- +/** @file + * @ingroup Field + * @brief + * 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: @@ -69,7 +71,7 @@ // ---------------------------------------------------------------------------- -// FieldEngineBaseData holds an engine and the relations. +/// FieldEngineBaseData holds an engine and the relations. // ---------------------------------------------------------------------------- template @@ -119,8 +121,8 @@ // ---------------------------------------------------------------------------- -// FieldEngineBase manages a hierarchy of engines, making it possible for -// FieldEngine specializations to implement geometry-specific behavior only. +/// FieldEngineBase manages a hierarchy of engines, making it possible for +/// FieldEngine specializations to implement geometry-specific behavior only. // ---------------------------------------------------------------------------- template @@ -146,7 +148,7 @@ //--------------------------------------------------------------------------- // Constructors. - // Default constructor. + /// Default constructor. FieldEngine() : num_materials_m(0), @@ -154,7 +156,7 @@ guards_m(0) { } - // General version takes centering, layout, mesh, materials + /// General version takes centering, layout, mesh, materials template FieldEngine(const Centering ¢ering, const Layout2 &layout, @@ -166,8 +168,7 @@ guards_m(layout.externalGuards()), mesh_m(mesh) { - shrinkInPlace(physicalCellDomain_m, guards_m); - shrinkRightInPlace(physicalCellDomain_m, 1); + physicalCellDomain_m = shrinkRight(shrink(physicalCellDomain_m, guards_m), 1); addSubFields(); for (int m = 0; m < num_materials_m; ++m) { @@ -178,7 +179,7 @@ } } - // Copy constructor. + /// Copy constructor. FieldEngine(const This_t &model) : num_materials_m(model.num_materials_m), @@ -191,8 +192,8 @@ { } - // Sub-field view constructor. This is when we want to construct a view of - // one of the subFields in our top-level list. + /// Sub-field view constructor. This is when we want to construct a view of + /// one of the subFields in our top-level list. FieldEngine(const This_t &model, int subField) : num_materials_m(1), @@ -238,7 +239,7 @@ data_m = model.data_m + c; } - // View constructors. + /// View constructors. template FieldEngine(const FieldEngine &model, @@ -276,7 +277,7 @@ } } - // This constructor handle weird things like range views. + /// This constructor handle weird things like range views. template FieldEngine(const FieldEngine &model, @@ -437,7 +438,8 @@ //--------------------------------------------------------------------------- - // Accessors and modifiers. + //@name Accessors and modifiers. + //@{ void addSubFields() { @@ -449,7 +451,7 @@ data_m.resize(size); } - // FIXME: This function is deprecated. + /// FIXME: This function is deprecated. inline int numSubFields() const { if (numMaterials() > 1) @@ -509,8 +511,11 @@ return num_materials_m; } + //@} + //--------------------------------------------------------------------------- - // Domain accessor functions. + //@name Domain accessor functions. + //@{ inline Domain_t &physicalCellDomain() { @@ -553,8 +558,11 @@ return cellDomainToCenteringDomain(totalCellDomain(), centering_m, i); } + //@} + //--------------------------------------------------------------------------- - // Centering accessors. + //@name Centering accessors. + //@{ const Centering ¢ering() const { @@ -566,8 +574,11 @@ return centering_m.size(); } + //@} + //--------------------------------------------------------------------------- - // Mesh accessors. + //@name Mesh accessors. + //@{ Mesh &mesh() { @@ -579,8 +590,10 @@ return mesh_m; } + //@} + //--------------------------------------------------------------------------- - // Make a distinct copy of this fieldEngineBase. + /// Make a distinct copy of this fieldEngineBase. template void makeOwnCopy(const Subject &s) @@ -609,10 +622,9 @@ //--------------------------------------------------------------------------- - // Domain translation function. - - // FIXME: This function should go away. Currently it's only used by - // the lagrangian field engine. + /// Domain translation function. + /// FIXME: This function should go away. Currently it's only used by + /// the lagrangian field engine. inline Domain_t translateToVertexDomain(const Domain_t &d) const @@ -633,7 +645,8 @@ } //--------------------------------------------------------------------------- - // Access material, centering subfield data. + //@name Access material, centering subfield data. + //@{ inline Data_t & data(int material, int centering) @@ -641,14 +654,15 @@ PAssert(data_m.isValid()); return data_m[material * stride_m + centering]; } - + inline const Data_t & data(int material, int centering) const { PAssert(data_m.isValid()); return data_m[material * stride_m + centering]; } - + + //@} private: Index: src/Layout/GuardLayers.h =================================================================== RCS file: /home/pooma/Repository/r2/src/Layout/GuardLayers.h,v retrieving revision 1.9 diff -u -r1.9 GuardLayers.h --- src/Layout/GuardLayers.h 2000/07/11 22:10:51 1.9 +++ src/Layout/GuardLayers.h 2002/08/02 10:27:45 @@ -34,11 +34,11 @@ #ifndef POOMA_LAYOUT_GUARDLAYERS_H #define POOMA_LAYOUT_GUARDLAYERS_H -//----------------------------------------------------------------------------- -// Overview: -// -// A simple container for a set of guard layer specifications. -//----------------------------------------------------------------------------- +/** @file + * @ingroup Layout + * @brief + * A simple container for a set of guard layer specifications. + */ //----------------------------------------------------------------------------- // Include Files @@ -49,12 +49,12 @@ //----------------------------------------------------------------------------- // -// Full Description: +/** // // This class is a simple container for two arrays of Dim integers, // specifying the numbers of guard layers at the upper and lower extent // of each dimension. -// +*/ //----------------------------------------------------------------------------- template @@ -259,43 +259,31 @@ }; template -Interval &growInPlace(Interval &dom, const GuardLayers &gcs) +inline Interval +grow(const Interval &dom, const GuardLayers &gcs) { + Interval ret = Pooma::NoInit(); for (int d = 0; d < Dim; ++d) { int a = dom[d].first() - gcs.lower(d); int b = dom[d].last() + gcs.upper(d); - dom[d] = Interval<1>(a,b); + ret[d] = Interval<1>(a,b); } - return dom; + return ret; } template -Interval &shrinkInPlace(Interval &dom, const GuardLayers &gcs) +inline Interval +shrink(const Interval &dom, const GuardLayers &gcs) { + Interval ret = Pooma::NoInit(); for (int d = 0; d < Dim; ++d) { int a = dom[d].first() + gcs.lower(d); int b = dom[d].last() - gcs.upper(d); - dom[d] = Interval<1>(a,b); + ret[d] = Interval<1>(a,b); } - return dom; -} - -template -inline Interval -grow(const Interval &dom, const GuardLayers &gcs) -{ - Interval ret(dom); - return growInPlace(ret, gcs); -} - -template -inline Interval -shrink(const Interval &dom, const GuardLayers &gcs) -{ - Interval ret(dom); - return shrinkInPlace(ret, gcs); + return ret; } //-----------------------------------------------------------------------------