RFA: Miscellaneous NewField Related Code Changes
Jeffrey Oldham
oldham at codesourcery.com
Fri May 4 01:11:21 UTC 2001
When investigating Dave Nyholm's X.cc and related code, I came across
minor errors corrected in the attached patch. OK to commit the changes?
2001-05-03 Jeffrey D. Oldham <oldham at codesourcery.com>
* Engine/IndexFunctionEngine.h (Full Description): Fix grammar
error.
* Layout/LayoutBase.h (LayoutBaseViewData::LayoutBaseViewData):
Reorder initializers according to class declaration order.
* Layout/Node.h (Node::Node): Likewise.
* Layout/UniformGridLayout.h
(UniformGridLayout::UniformGridLayout): Likewise.
* NewField/FieldEngine/FieldEngine.NoGeometry.h
(FieldEngine::physicalCellDomain): Modify return type by removing
reference. Change second function call argument to match function
prototype.
(FieldEngine::totalCellDomain): Change second function call
argument to match function prototype.
* NewField/FieldEngine/FieldEngine.UR.h: Fix typographical errors
in initial comments.
* Utilities/DataBlockPtr.h
(DataBlockController::DataBlockController): Reorder initializers
according to class declaration order.
* Utilities/RefCountedBlockPtr.h
(RefBlockController::RefBlockController): Likewise.
Tested using Linux gcc 3.0 single-threaded by compiling library
Approved by ???you???
Thanks,
Jeffrey D. Oldham
oldham at codesourcery.com
-------------- next part --------------
Index: Engine/IndexFunctionEngine.h
===================================================================
RCS file: /home/pooma/Repository/r2/src/Engine/IndexFunctionEngine.h,v
retrieving revision 1.21
diff -c -p -r1.21 IndexFunctionEngine.h
*** Engine/IndexFunctionEngine.h 2001/04/11 21:39:27 1.21
--- Engine/IndexFunctionEngine.h 2001/05/04 00:39:02
***************
*** 63,69 ****
// Full Description:
//
// IndexFunction is just a tag class for the index-function-engine engine,
! // which makes function of indices look like an array. It takes a Functor
// class type as a template argument. This functor is what turns indices
// into function values. IndexFunctionView is the view analog of IndexFunction.
// In addition to the function, this class includes the original dimension.
--- 63,69 ----
// Full Description:
//
// IndexFunction is just a tag class for the index-function-engine engine,
! // which makes a function of indices look like an array. It takes a Functor
// class type as a template argument. This functor is what turns indices
// into function values. IndexFunctionView is the view analog of IndexFunction.
// In addition to the function, this class includes the original dimension.
Index: Layout/LayoutBase.h
===================================================================
RCS file: /home/pooma/Repository/r2/src/Layout/LayoutBase.h,v
retrieving revision 1.21
diff -c -p -r1.21 LayoutBase.h
*** Layout/LayoutBase.h 2001/04/01 20:35:57 1.21
--- Layout/LayoutBase.h 2001/05/04 00:39:03
*************** public:
*** 798,807 ****
template<class DT>
LayoutBaseViewData(const L & layout, const Domain<Dim,DT> & dom)
! : layout_m(layout), indexer_m(dom),
! id_m(Unique::get()), subdomainsComputed_m(false),
! internalGuards_m(layout.internalGuards()),
! externalGuards_m(layout.externalGuards())
{
// We cannot logically be a slice here.
--- 798,808 ----
template<class DT>
LayoutBaseViewData(const L & layout, const Domain<Dim,DT> & dom)
! : id_m(Unique::get()), layout_m(layout),
! internalGuards_m(layout.internalGuards()),
! externalGuards_m(layout.externalGuards()),
! indexer_m(dom),
! subdomainsComputed_m(false)
{
// We cannot logically be a slice here.
Index: Layout/Node.h
===================================================================
RCS file: /home/pooma/Repository/r2/src/Layout/Node.h,v
retrieving revision 1.34
diff -c -p -r1.34 Node.h
*** Layout/Node.h 2001/04/11 21:39:27 1.34
--- Layout/Node.h 2001/05/04 00:39:04
*************** public:
*** 162,170 ****
// The copy constructor
Node(const This_t &n)
! : domain_m(n.domain_m), context_m(n.context_m), allocated_m(n.allocated_m),
! global_m(n.global_m), local_m(n.local_m),
! affinity_m(n.affinity_m)
{
}
--- 162,170 ----
// The copy constructor
Node(const This_t &n)
! : domain_m(n.domain_m), allocated_m(n.allocated_m),
! local_m(n.local_m), global_m(n.global_m),
! context_m(n.context_m), affinity_m(n.affinity_m)
{
}
Index: Layout/UniformGridLayout.h
===================================================================
RCS file: /home/pooma/Repository/r2/src/Layout/UniformGridLayout.h,v
retrieving revision 1.80
diff -c -p -r1.80 UniformGridLayout.h
*** Layout/UniformGridLayout.h 2000/06/27 19:11:34 1.80
--- Layout/UniformGridLayout.h 2001/05/04 00:39:04
*************** UniformGridLayout(const Domain_t &gdom,
*** 1826,1833 ****
template <int Dim>
inline UniformGridLayout<Dim>::
UniformGridLayout(const This_t &model)
! : Observable<This_t>(*this),
! LayoutBase<Dim,UniformGridLayoutData<Dim> >(model.pdata_m)
{
pdata_m->attach(*this);
}
--- 1826,1833 ----
template <int Dim>
inline UniformGridLayout<Dim>::
UniformGridLayout(const This_t &model)
! : LayoutBase<Dim,UniformGridLayoutData<Dim> >(model.pdata_m),
! Observable<This_t>(*this)
{
pdata_m->attach(*this);
}
Index: NewField/FieldEngine/FieldEngine.NoGeometry.h
===================================================================
RCS file: /home/pooma/Repository/r2/src/NewField/FieldEngine/FieldEngine.NoGeometry.h,v
retrieving revision 1.4
diff -c -p -r1.4 FieldEngine.NoGeometry.h
*** NewField/FieldEngine/FieldEngine.NoGeometry.h 2001/04/10 23:13:25 1.4
--- NewField/FieldEngine/FieldEngine.NoGeometry.h 2001/05/04 00:39:06
*************** public:
*** 254,267 ****
// This field-engine always has vert-centering and the total domain is
// given by the engine.
! inline const Domain_t &physicalCellDomain() const
{
! return shrink(physicalDomain(), 1);
}
inline Domain_t totalCellDomain() const
{
! return shrink(engine_m.domain(), 1);
}
Domain_t physicalDomain() const
--- 254,267 ----
// This field-engine always has vert-centering and the total domain is
// given by the engine.
! inline const Domain_t physicalCellDomain() const
{
! return shrink(physicalDomain(), guards_m);
}
inline Domain_t totalCellDomain() const
{
! return shrink(engine_m.domain(), guards_m);
}
Domain_t physicalDomain() const
Index: NewField/FieldEngine/FieldEngine.UR.h
===================================================================
RCS file: /home/pooma/Repository/r2/src/NewField/FieldEngine/FieldEngine.UR.h,v
retrieving revision 1.5
diff -c -p -r1.5 FieldEngine.UR.h
*** NewField/FieldEngine/FieldEngine.UR.h 2001/04/10 23:13:25 1.5
--- NewField/FieldEngine/FieldEngine.UR.h 2001/05/04 00:39:06
***************
*** 28,35 ****
//-----------------------------------------------------------------------------
// Classes:
! // UniformRectilinear<Dim, TM, CoordinatSystem>
! // FieldEngine<UniformRecilinear, T, EngineTag>
//-----------------------------------------------------------------------------
#ifndef POOMA_NEWFIELD_FIELDENGINE_UR_H
--- 28,35 ----
//-----------------------------------------------------------------------------
// Classes:
! // UniformRectilinear<Dim, TM, CoordinateSystem>
! // FieldEngine<UniformRectilinear, T, EngineTag>
//-----------------------------------------------------------------------------
#ifndef POOMA_NEWFIELD_FIELDENGINE_UR_H
Index: NewField/tests/FieldTour1.cpp
===================================================================
RCS file: /home/pooma/Repository/r2/src/NewField/tests/FieldTour1.cpp,v
retrieving revision 1.4
diff -c -p -r1.4 FieldTour1.cpp
*** NewField/tests/FieldTour1.cpp 2001/04/10 23:13:25 1.4
--- NewField/tests/FieldTour1.cpp 2001/05/04 00:39:06
*************** int main(int argc, char *argv[])
*** 51,61 ****
// awhile. Also, it means that the same layout can be used for all
// fields, regardless of centering.
! Interval<2> physicalVertexDomain(4, 4);
! Loc<2> blocks(1, 2);
! UniformGridPartition<2> partition(blocks, GuardLayers<2>(1));
! UniformGridLayout<2> layout(physicalVertexDomain, partition, LayoutTag_t());
std::cout << layout << std::endl;
std::cout << layout.domain() << std::endl;
--- 51,61 ----
// awhile. Also, it means that the same layout can be used for all
// fields, regardless of centering.
! Interval<2> physicalVertexDomain(4, 4); // 0..3 x 0..3
! Loc<2> blocks(1, 2); // x-direction has one block, y-dir has two blocks
! UniformGridPartition<2> partition(blocks, GuardLayers<2>(1)); // add one layer of guard cells in each direction
! UniformGridLayout<2> layout(physicalVertexDomain, partition, ReplicatedTag());
std::cout << layout << std::endl;
std::cout << layout.domain() << std::endl;
*************** int main(int argc, char *argv[])
*** 77,85 ****
// domain back because of the all-face centering. We can get the
// face-domains by specifying the sub-fields.
! std::cout << f.physicalDomain() << std::endl;
! std::cout << f.physicalDomain(0) << std::endl;
! std::cout << f.physicalDomain(1) << std::endl;
// Total domains work similarly.
--- 77,85 ----
// domain back because of the all-face centering. We can get the
// face-domains by specifying the sub-fields.
! std::cout << f.physicalDomain() << std::endl; // cell orientation
! std::cout << f.physicalDomain(0) << std::endl; // x face orientation
! std::cout << f.physicalDomain(1) << std::endl; // y face orientation
// Total domains work similarly.
*************** int main(int argc, char *argv[])
*** 89,96 ****
// We can do a similar sort of thing by taking sub-field views.
! std::cout << f[0].physicalDomain() << std::endl;
! std::cout << f[1].physicalDomain() << std::endl;
// Total domains work similarly. Note: taking a sub-field view doesn't
// remove the guard layers.
--- 89,96 ----
// We can do a similar sort of thing by taking sub-field views.
! std::cout << f[0].physicalDomain() << std::endl; // x faces
! std::cout << f[1].physicalDomain() << std::endl; // y faces
// Total domains work similarly. Note: taking a sub-field view doesn't
// remove the guard layers.
*************** int main(int argc, char *argv[])
*** 122,128 ****
// Check assignment of a scalar.
! f = -1.0;
f(I, I) = -2.0;
std::cout << f << std::endl;
--- 122,128 ----
// Check assignment of a scalar.
! f = -1.0; // assign physical domain
f(I, I) = -2.0;
std::cout << f << std::endl;
*************** int main(int argc, char *argv[])
*** 148,156 ****
std::cout << h.fieldEngine().vertexPositions() << std::endl;
! // Try assigning to a field with a lagranigan mesh.
! h.all() = 3.0;
h = -6.0;
std::cout << h.all() << std::endl;
--- 148,156 ----
std::cout << h.fieldEngine().vertexPositions() << std::endl;
! // Try assigning to a field with a Lagrangian mesh.
! h.all() = 3.0; // .all means also set guards as well as physical
h = -6.0;
std::cout << h.all() << std::endl;
*************** int main(int argc, char *argv[])
*** 177,183 ****
}
// Play with updaters.
-
// f.addUpdaters(AllConstantFaceBC<double>(-1.0));
f.addUpdaters(AllPosReflectFaceBC());
f.update(true);
--- 177,182 ----
*************** int main(int argc, char *argv[])
*** 193,199 ****
l.all() = Vector<2>(-1.0, 2.0);
l = Vector<2>(4.0, 6.0);
!
std::cout << l.all().comp(0) << std::endl;
Pooma::finalize();
--- 192,198 ----
l.all() = Vector<2>(-1.0, 2.0);
l = Vector<2>(4.0, 6.0);
!
std::cout << l.all().comp(0) << std::endl;
Pooma::finalize();
Index: NewField/tests/FieldTour2.cpp
===================================================================
RCS file: /home/pooma/Repository/r2/src/NewField/tests/FieldTour2.cpp,v
retrieving revision 1.1
diff -c -p -r1.1 FieldTour2.cpp
*** NewField/tests/FieldTour2.cpp 2000/07/24 23:36:22 1.1
--- NewField/tests/FieldTour2.cpp 2001/05/04 00:39:06
*************** int main(int argc, char *argv[])
*** 49,56 ****
// field with cell centering.
typedef Field<UniformRectilinear<2>, double, Brick> Field_t;
! Field_t f(ReplicateSubFields<Cell>(3), layout,
Vector<2>(0.0), Vector<2>(1.0, 2.0));
// Set some data in the field.
--- 49,57 ----
// field with cell centering.
typedef Field<UniformRectilinear<2>, double, Brick> Field_t;
! Field_t f(ReplicateSubFields<Cell>(3), layout, // 3 fields each Cell-centered
Vector<2>(0.0), Vector<2>(1.0, 2.0));
+ // are composable
// Set some data in the field.
Index: NewField/tests/ScalarCode.cpp
===================================================================
RCS file: /home/pooma/Repository/r2/src/NewField/tests/ScalarCode.cpp,v
retrieving revision 1.6
diff -c -p -r1.6 ScalarCode.cpp
*** NewField/tests/ScalarCode.cpp 2001/04/10 23:13:25 1.6
--- NewField/tests/ScalarCode.cpp 2001/05/04 00:39:06
*************** int main(int argc, char *argv[])
*** 442,448 ****
double check2 = sum(edgeValues * edgeValues);
tester.out() << "check value: " << check2 << std::endl;
! tester.check("value from derivative computation", abs(check2 - 134.8) < 0.2);
// final cases to consider:
// 1) replicated fields
--- 442,448 ----
double check2 = sum(edgeValues * edgeValues);
tester.out() << "check value: " << check2 << std::endl;
! tester.check("value from derivative computation", std::abs(check2 - 134.8) < 0.2);
// final cases to consider:
// 1) replicated fields
Index: Partition/UniformMapper.h
===================================================================
RCS file: /home/pooma/Repository/r2/src/Partition/UniformMapper.h,v
retrieving revision 1.3
diff -c -p -r1.3 UniformMapper.h
*** Partition/UniformMapper.h 2000/06/07 23:36:46 1.3
--- Partition/UniformMapper.h 2001/05/04 00:39:06
*************** public:
*** 84,89 ****
--- 84,91 ----
{
}
+ virtual ~UniformMapper(){}
+
void map(const List_t&) const;
// member data
Index: Utilities/DataBlockPtr.h
===================================================================
RCS file: /home/pooma/Repository/r2/src/Utilities/DataBlockPtr.h,v
retrieving revision 1.19
diff -c -p -r1.19 DataBlockPtr.h
*** Utilities/DataBlockPtr.h 2000/12/29 03:00:23 1.19
--- Utilities/DataBlockPtr.h 2001/05/04 00:39:07
*************** public:
*** 202,211 ****
// Observable with the default constructor.
DataBlockController(const DataBlockController &model)
! : Base_t(model), observable_m(),
! owned_m(model.dataObjectPtr_m ? true : false),
dataObjectPtr_m(model.dataObjectPtr_m ?
new DataObject_t(model.affinity()) : 0),
dynamicID_m(ObserverEvent::nullID())
{ }
--- 202,212 ----
// Observable with the default constructor.
DataBlockController(const DataBlockController &model)
! : Base_t(model),
dataObjectPtr_m(model.dataObjectPtr_m ?
new DataObject_t(model.affinity()) : 0),
+ owned_m(model.dataObjectPtr_m ? true : false),
+ observable_m(),
dynamicID_m(ObserverEvent::nullID())
{ }
Index: Utilities/Observer.h
===================================================================
RCS file: /home/pooma/Repository/r2/src/Utilities/Observer.h,v
retrieving revision 1.11
diff -c -p -r1.11 Observer.h
*** Utilities/Observer.h 2001/03/29 19:06:45 1.11
--- Utilities/Observer.h 2001/05/04 00:39:07
*************** public:
*** 126,135 ****
// Destructors
//============================================================
! // The destructor is not made virtual, since we should not ever need
! // to delete an object via its Observer base class.
!
! ~Observer()
{
}
--- 126,132 ----
// Destructors
//============================================================
! virtual ~Observer()
{
}
Index: Utilities/RefCountedBlockPtr.h
===================================================================
RCS file: /home/pooma/Repository/r2/src/Utilities/RefCountedBlockPtr.h,v
retrieving revision 1.59
diff -c -p -r1.59 RefCountedBlockPtr.h
*** Utilities/RefCountedBlockPtr.h 2001/04/11 21:39:28 1.59
--- Utilities/RefCountedBlockPtr.h 2001/05/04 00:39:07
*************** public:
*** 192,198 ****
// class to zero.
RefBlockController(const RefBlockController &model)
! : dealloc_m(false), pBegin_m(0), pEnd_m(0), pEndOfStorage_m(0)
{
// Get the size ofs the logical and allocated storage:
--- 192,198 ----
// class to zero.
RefBlockController(const RefBlockController &model)
! : pBegin_m(0), pEnd_m(0), pEndOfStorage_m(0), dealloc_m(false)
{
// Get the size ofs the logical and allocated storage:
*************** protected:
*** 1038,1045 ****
// controllers, which may take additional constructor arguments.
RefCountedBlockPtr(Controller *con)
! : blockControllerPtr_m(con),
! offset_m(0)
{ }
// Utility function: Check bounds and throw assertion if
--- 1038,1044 ----
// controllers, which may take additional constructor arguments.
RefCountedBlockPtr(Controller *con)
! : offset_m(0), blockControllerPtr_m(con)
{ }
// Utility function: Check bounds and throw assertion if
More information about the pooma-dev
mailing list