[newfield_revision] Patch: Miscellaneous Changes
Jeffrey Oldham
oldham at codesourcery.com
Tue Aug 14 20:23:38 UTC 2001
This patch, applied to the newfield_revision branch, does:
1) Revises some code to use orientation() and position().
2) Changes some user code from the deprecated <field>.numSubFields()
to <field>.numMaterials() and <field>.centering().
3) Ensures that numMaterials(), centering(), and num_materials_m are
available from all field engines.
2001-08-14 Jeffrey D. Oldham <oldham at codesourcery.com>
* FieldCentering.h (Centering::orientation): New function.
(Centering::position): New function.
(operator<<(..., Centering)): Revise to use the two previous
functions.
* FieldReductions.h (sum): Revise assertion to use user Field code.
(prod): Likewise.
(min): Likewise.
(max): Likewise.
(all): Likewise.
(any): Likewise.
(bitOr): Likewise.
(bitAnd): Likewise.
* NearestNeighbors.h (inputPosition): New function.
* DiffOps/FieldShiftEngine.h (Engine::Engine): Revise initializer.
(Engine::Engine(NoInit)): Remove function.
* DiffOps/FieldStencil.h (Engine::Engine): Revise initializer.
(Engine::Engine(NoInit)): Remove function.
* FieldEngine/FieldEngine.NoGeometry.h (FieldEngine<NoGeometry ...>):
Derive from FieldEngineBase.
(FieldEngine::numSubFields): Mark this function as deprecatd.
* FieldEngine/FieldEngineBase.ExprEngine.h
(FieldEngineBase::numSubFields): Likewise.
(FieldEngineBase::centering): New function.
(FieldEngineBase::centeringSize): New function.
(FieldEngineBase::numMaterials): New function.
* FieldEngine/FieldEngineBase.h
(FieldEngineBase::FieldEngineBase): Revise to use Centering's
orientation().
(FieldEngineBase::FieldEngineBase): Fix num_materials_m's
initialization.
(FieldEngineBase::initialize): Move num_materials_m initialization
to occur for all field types.
(FieldEngineBase::initialize): Likewise. Const'ify variable.
(FieldEngineBase::initialize): Add num_materials_m initialization.
(FieldEngineBase::initialize): Move num_materials_m initialization
to occur for all field types. Const'ify variable.
* (FieldEngineBase::numSubFields): Mark function as deprecated.
(FieldEngineBase::centeringSize): Move nearer centering().
* Mesh/UniformRectilinearMesh.h
(UniformRectilinearMesh::PositionsFunctor::PositionsFunctor):
Revise to use Centering's position().
* Updater/ConstantFaceBC.h: Revise assertion to use user Field code.
* Updater/PeriodicFaceBC.cpp: Likewise.
* Updater/PosReflectFaceBC.cpp: Likewise.
* tests/NearestNeighbors.cpp (manhattanDistance): Simplify to use
inputPosition().
* tests/makefile: Alphabetize.
Tested on sequential Linux using gcc 3.0.1 by compiling Pooma and NewField tests
Approved by Stephen Smith
Applied to newfield_revision branch
Thanks,
Jeffrey D. Oldham
oldham at codesourcery.com
-------------- next part --------------
? 13Aug.14.4.patch
? LINUXgcc
? 14Aug.13.0.patch
? tests/LINUXgcc
Index: FieldCentering.h
===================================================================
RCS file: /home/pooma/Repository/r2/src/NewField/Attic/FieldCentering.h,v
retrieving revision 1.1.2.8
diff -c -p -r1.1.2.8 FieldCentering.h
*** FieldCentering.h 2001/08/13 21:14:30 1.1.2.8
--- FieldCentering.h 2001/08/14 19:58:26
*************** std::ostream &operator<<(std::ostream &o
*** 483,490 ****
<< ",{";
for (int i = 0; i < centering.size();)
{
! o << "[" << centering.orientations()[i]
! << "," << centering.positions()[i] << "]";
++i;
if (i < centering.size())
o << ",";
--- 483,490 ----
<< ",{";
for (int i = 0; i < centering.size();)
{
! o << "[" << centering.orientation(i)
! << "," << centering.position(i) << "]";
++i;
if (i < centering.size())
o << ",";
Index: FieldReductions.h
===================================================================
RCS file: /home/pooma/Repository/r2/src/NewField/FieldReductions.h,v
retrieving revision 1.3
diff -c -p -r1.3 FieldReductions.h
*** FieldReductions.h 2001/04/27 23:37:33 1.3
--- FieldReductions.h 2001/08/14 19:58:26
*************** class Field;
*** 64,72 ****
template<class GeometryTag, class T, class EngineTag>
T sum(const Field<GeometryTag, T, EngineTag> &f)
{
! // These versions only work with fields with no sub-fields.
! PAssert(f.numSubFields() == 0);
// We need to notify the field that we are reducing that we are getting
// ready to read.
--- 64,72 ----
template<class GeometryTag, class T, class EngineTag>
T sum(const Field<GeometryTag, T, EngineTag> &f)
{
! // These versions only work with fields with one value per cell.
! PAssert(f.numMaterials() <= 1 && f.centering().size() <= 1);
// We need to notify the field that we are reducing that we are getting
// ready to read.
*************** T sum(const Field<GeometryTag, T, Engine
*** 83,91 ****
template<class GeometryTag, class T, class EngineTag>
T prod(const Field<GeometryTag, T, EngineTag> &f)
{
! // These versions only work with fields with no sub-fields.
! PAssert(f.numSubFields() == 0);
// We need to notify the field that we are reducing that we are getting
// ready to read.
--- 83,91 ----
template<class GeometryTag, class T, class EngineTag>
T prod(const Field<GeometryTag, T, EngineTag> &f)
{
! // These versions only work with fields with one value per cell.
! PAssert(f.numMaterials() <= 1 && f.centering().size() <= 1);
// We need to notify the field that we are reducing that we are getting
// ready to read.
*************** T prod(const Field<GeometryTag, T, Engin
*** 102,110 ****
template<class GeometryTag, class T, class EngineTag>
T min(const Field<GeometryTag, T, EngineTag> &f)
{
! // These versions only work with fields with no sub-fields.
! PAssert(f.numSubFields() == 0);
// We need to notify the field that we are reducing that we are getting
// ready to read.
--- 102,110 ----
template<class GeometryTag, class T, class EngineTag>
T min(const Field<GeometryTag, T, EngineTag> &f)
{
! // These versions only work with fields with one value per cell.
! PAssert(f.numMaterials() <= 1 && f.centering().size() <= 1);
// We need to notify the field that we are reducing that we are getting
// ready to read.
*************** T min(const Field<GeometryTag, T, Engine
*** 121,129 ****
template<class GeometryTag, class T, class EngineTag>
T max(const Field<GeometryTag, T, EngineTag> &f)
{
! // These versions only work with fields with no sub-fields.
! PAssert(f.numSubFields() == 0);
// We need to notify the field that we are reducing that we are getting
// ready to read.
--- 121,129 ----
template<class GeometryTag, class T, class EngineTag>
T max(const Field<GeometryTag, T, EngineTag> &f)
{
! // These versions only work with fields with one value per cell.
! PAssert(f.numMaterials() <= 1 && f.centering().size() <= 1);
// We need to notify the field that we are reducing that we are getting
// ready to read.
*************** T max(const Field<GeometryTag, T, Engine
*** 140,148 ****
template<class GeometryTag, class T, class EngineTag>
bool all(const Field<GeometryTag, T, EngineTag> &f)
{
! // These versions only work with fields with no sub-fields.
! PAssert(f.numSubFields() == 0);
// We need to notify the field that we are reducing that we are getting
// ready to read.
--- 140,148 ----
template<class GeometryTag, class T, class EngineTag>
bool all(const Field<GeometryTag, T, EngineTag> &f)
{
! // These versions only work with fields with one value per cell.
! PAssert(f.numMaterials() <= 1 && f.centering().size() <= 1);
// We need to notify the field that we are reducing that we are getting
// ready to read.
*************** bool all(const Field<GeometryTag, T, Eng
*** 159,167 ****
template<class GeometryTag, class T, class EngineTag>
bool any(const Field<GeometryTag, T, EngineTag> &f)
{
! // These versions only work with fields with no sub-fields.
! PAssert(f.numSubFields() == 0);
// We need to notify the field that we are reducing that we are getting
// ready to read.
--- 159,167 ----
template<class GeometryTag, class T, class EngineTag>
bool any(const Field<GeometryTag, T, EngineTag> &f)
{
! // These versions only work with fields with one value per cell.
! PAssert(f.numMaterials() <= 1 && f.centering().size() <= 1);
// We need to notify the field that we are reducing that we are getting
// ready to read.
*************** bool any(const Field<GeometryTag, T, Eng
*** 178,186 ****
template<class GeometryTag, class T, class EngineTag>
T bitOr(const Field<GeometryTag, T, EngineTag> &f)
{
! // These versions only work with fields with no sub-fields.
! PAssert(f.numSubFields() == 0);
// We need to notify the field that we are reducing that we are getting
// ready to read.
--- 178,186 ----
template<class GeometryTag, class T, class EngineTag>
T bitOr(const Field<GeometryTag, T, EngineTag> &f)
{
! // These versions only work with fields with one value per cell.
! PAssert(f.numMaterials() <= 1 && f.centering().size() <= 1);
// We need to notify the field that we are reducing that we are getting
// ready to read.
*************** T bitOr(const Field<GeometryTag, T, Engi
*** 197,205 ****
template<class GeometryTag, class T, class EngineTag>
T bitAnd(const Field<GeometryTag, T, EngineTag> &f)
{
! // These versions only work with fields with no sub-fields.
! PAssert(f.numSubFields() == 0);
// We need to notify the field that we are reducing that we are getting
// ready to read.
--- 197,205 ----
template<class GeometryTag, class T, class EngineTag>
T bitAnd(const Field<GeometryTag, T, EngineTag> &f)
{
! // These versions only work with fields with one value per cell.
! PAssert(f.numMaterials() <= 1 && f.centering().size() <= 1);
// We need to notify the field that we are reducing that we are getting
// ready to read.
Index: NearestNeighbors.h
===================================================================
RCS file: /home/pooma/Repository/r2/src/NewField/Attic/NearestNeighbors.h,v
retrieving revision 1.1.2.2
diff -c -p -r1.1.2.2 NearestNeighbors.h
*** NearestNeighbors.h 2001/08/13 21:14:30 1.1.2.2
--- NearestNeighbors.h 2001/08/14 19:58:26
*************** private:
*** 327,334 ****
cellOffsetCoordinate[0] = -1;
return 1;
}
! else
PInsist(0, "Out of range difference");
}
// Specify a partial order for FieldOffsets to use when removing
--- 327,336 ----
cellOffsetCoordinate[0] = -1;
return 1;
}
! else {
PInsist(0, "Out of range difference");
+ return 0; // Keep the compiler quiet.
+ }
}
// Specify a partial order for FieldOffsets to use when removing
Index: FieldEngine/FieldEngine.NoGeometry.h
===================================================================
RCS file: /home/pooma/Repository/r2/src/NewField/FieldEngine/FieldEngine.NoGeometry.h,v
retrieving revision 1.5
diff -c -p -r1.5 FieldEngine.NoGeometry.h
*** FieldEngine/FieldEngine.NoGeometry.h 2001/05/14 21:11:24 1.5
--- FieldEngine/FieldEngine.NoGeometry.h 2001/08/14 19:58:26
*************** struct NoGeometry;
*** 79,85 ****
//-----------------------------------------------------------------------------
template<int Dim, class T, class EngineTag>
! class FieldEngine<NoGeometry<Dim>, T, EngineTag>
{
public:
--- 79,86 ----
//-----------------------------------------------------------------------------
template<int Dim, class T, class EngineTag>
! class FieldEngine<NoGeometry<Dim>, T, EngineTag> :
! public FieldEngineBase<Dim, T, EngineTag>
{
public:
*************** public:
*** 217,222 ****
--- 218,224 ----
//---------------------------------------------------------------------------
// Accessors and modifiers.
+ // FIXME: This function is deprecated.
inline int numSubFields() const
{
return 0;
*************** public:
*** 294,300 ****
PAssert(iSubField == 0);
return engine_m.domain();
}
-
//---------------------------------------------------------------------------
// Make a distinct copy of this fieldEngineBase.
--- 296,301 ----
Index: FieldEngine/FieldEngineBase.ExprEngine.h
===================================================================
RCS file: /home/pooma/Repository/r2/src/NewField/FieldEngine/FieldEngineBase.ExprEngine.h,v
retrieving revision 1.12
diff -c -p -r1.12 FieldEngineBase.ExprEngine.h
*** FieldEngine/FieldEngineBase.ExprEngine.h 2001/06/22 22:49:35 1.12
--- FieldEngine/FieldEngineBase.ExprEngine.h 2001/08/14 19:58:26
*************** public:
*** 237,242 ****
--- 237,243 ----
//---------------------------------------------------------------------------
// Accessors and modifiers.
+ // FIXME: This function is deprecated.
inline int numSubFields() const
{
return referenceField().numSubFields();
*************** public:
*** 289,294 ****
--- 290,313 ----
Domain_t totalDomain(int iSubField) const
{
return referenceField_m.totalDomain(iSubField);
+ }
+
+ //---------------------------------------------------------------------------
+ // Centering accessors.
+
+ const Centering<Dim> ¢ering() const
+ {
+ return referenceField_m.centering();
+ }
+
+ inline int centeringSize() const
+ {
+ return referenceField_m.centering().size();
+ }
+
+ inline int numMaterials() const
+ {
+ return referenceField_m.numMaterials();
}
Index: FieldEngine/FieldEngineBase.h
===================================================================
RCS file: /home/pooma/Repository/r2/src/NewField/FieldEngine/FieldEngineBase.h,v
retrieving revision 1.13.2.4
diff -c -p -r1.13.2.4 FieldEngineBase.h
*** FieldEngine/FieldEngineBase.h 2001/08/13 21:14:31 1.13.2.4
--- FieldEngine/FieldEngineBase.h 2001/08/14 19:58:26
*************** public:
*** 177,190 ****
for (int c = 0; c < centering.size(); ++ c)
{
Loc<Dim> offset(1);
! offset -= centering.orientations()[c];
subField(c).data_m = new Data_t(offset, Pooma::NoInit());
}
}
else
{
Loc<Dim> offset(1);
! offset -= centering.orientations()[0];
data_m = new Data_t(offset, Pooma::NoInit());
}
}
--- 177,190 ----
for (int c = 0; c < centering.size(); ++ c)
{
Loc<Dim> offset(1);
! offset -= centering.orientation(c);
subField(c).data_m = new Data_t(offset, Pooma::NoInit());
}
}
else
{
Loc<Dim> offset(1);
! offset -= centering.orientation(0);
data_m = new Data_t(offset, Pooma::NoInit());
}
}
*************** public:
*** 212,225 ****
for (int c = 0; c < centering.size(); ++ c)
{
Loc<Dim> offset(1);
! offset -= centering.orientations()[c];
subField(m).subField(c).data_m = new Data_t(offset, layout);
}
}
else
{
Loc<Dim> offset(1);
! offset -= centering.orientations()[0];
subField(m).data_m = new Data_t(offset, layout);
}
}
--- 212,225 ----
for (int c = 0; c < centering.size(); ++ c)
{
Loc<Dim> offset(1);
! offset -= centering.orientation(c);
subField(m).subField(c).data_m = new Data_t(offset, layout);
}
}
else
{
Loc<Dim> offset(1);
! offset -= centering.orientation(0);
subField(m).data_m = new Data_t(offset, layout);
}
}
*************** public:
*** 232,245 ****
for (int c = 0; c < centering.size(); ++ c)
{
Loc<Dim> offset(1);
! offset -= centering.orientations()[c];
subField(c).data_m = new Data_t(offset, layout);
}
}
else
{
Loc<Dim> offset(1);
! offset -= centering.orientations()[0];
data_m = new Data_t(offset, layout);
}
}
--- 232,245 ----
for (int c = 0; c < centering.size(); ++ c)
{
Loc<Dim> offset(1);
! offset -= centering.orientation(c);
subField(c).data_m = new Data_t(offset, layout);
}
}
else
{
Loc<Dim> offset(1);
! offset -= centering.orientation(0);
data_m = new Data_t(offset, layout);
}
}
*************** public:
*** 265,271 ****
physicalCellDomain_m(model.physicalCellDomain_m),
guards_m(model.guards_m),
centering_m(model.subFields_m[iSubField].centering_m),
! num_materials_m(model.num_materials_m)
{
PInsist(iSubField >= 0 && iSubField < model.numSubFields(),
"Illegal attempt to extract a non-existent subfield.");
--- 265,271 ----
physicalCellDomain_m(model.physicalCellDomain_m),
guards_m(model.guards_m),
centering_m(model.subFields_m[iSubField].centering_m),
! num_materials_m(model.subFields_m[iSubField].num_materials_m)
{
PInsist(iSubField >= 0 && iSubField < model.numSubFields(),
"Illegal attempt to extract a non-existent subfield.");
*************** public:
*** 320,325 ****
--- 320,326 ----
{
int n = model.numSubFields();
s.centering_m = model.centering();
+ num_materials_m = model.numMaterials();
if (n == 0)
{
s.physicalCellDomain_m = shrinkRight(d - d.firsts(),
*************** public:
*** 329,335 ****
else
{
s.physicalCellDomain_m = d - d.firsts();
- num_materials_m = model.numMaterials();
s.addSubFields(n);
for (int i = 0; i < n; i++)
initialize(s.subFields_m[i], model.subField(i),
--- 330,335 ----
*************** public:
*** 343,348 ****
--- 343,349 ----
{
int n = model.numSubFields();
s.centering_m = model.centering();
+ num_materials_m = model.numMaterials();
if (n == 0)
{
s.physicalCellDomain_m =
*************** public:
*** 352,358 ****
else
{
s.physicalCellDomain_m = i.domain() - i.domain().firsts();
- num_materials_m = model.numMaterials();
s.addSubFields(n);
for (int j = 0; j < n; j++)
initialize(s.subFields_m[j], model.subField(j),
--- 353,358 ----
*************** public:
*** 366,372 ****
const EngineView<Tag> &ev)
{
typedef typename FieldEngineBase<Dim2, T2, EngineTag2>::Engine_t EngIn_t;
! int n = model.numSubFields();
s.centering_m = model.centering();
if (n == 0)
{
--- 366,373 ----
const EngineView<Tag> &ev)
{
typedef typename FieldEngineBase<Dim2, T2, EngineTag2>::Engine_t EngIn_t;
! const int n = model.numSubFields();
! num_materials_m = model.numMaterials();
s.centering_m = model.centering();
if (n == 0)
{
*************** public:
*** 381,387 ****
{
s.physicalCellDomain_m = model.physicalCellDomain();
s.guards_m = model.guardLayers();
- num_materials_m = model.numMaterials();
s.addSubFields(n);
for (int i = 0; i < n; i++)
initialize(s.subFields_m[i], model.subField(i), ev);
--- 382,387 ----
*************** public:
*** 393,398 ****
--- 393,399 ----
const FieldEngineBase<Dim, T, EngineTag2> &model, const EnginePatch &p)
{
PAssert(model.numSubFields() == 0);
+ num_materials_m = model.numMaterials();
s.initialize(model.offsets(), engineFunctor(model.engine(), p));
s.physicalCellDomain_m = shrinkRight(data_m->engine().domain(), 1);
}
*************** public:
*** 402,409 ****
const FieldEngineBase<Dim2, T2, EngineTag2> &model,
const ComponentWrapper<Components> &c)
{
! int n = model.numSubFields();
s.centering_m = model.centering();
if (n == 0)
{
s.physicalCellDomain_m = model.physicalCellDomain();
--- 403,411 ----
const FieldEngineBase<Dim2, T2, EngineTag2> &model,
const ComponentWrapper<Components> &c)
{
! const int n = model.numSubFields();
s.centering_m = model.centering();
+ num_materials_m = model.numMaterials();
if (n == 0)
{
s.physicalCellDomain_m = model.physicalCellDomain();
*************** public:
*** 416,422 ****
{
s.physicalCellDomain_m = model.physicalCellDomain();
s.guards_m = model.guardLayers();
- num_materials_m = model.numMaterials();
s.addSubFields(n);
for (int i = 0; i < n; i++)
initialize(s.subFields_m[i], model.subField(i), c);
--- 418,423 ----
*************** public:
*** 426,432 ****
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();
s.centering_m = model.centering();
--- 427,434 ----
void initialize(This_t &s, const This_t &model,
const Pooma::Updaters::DontCopyUpdaters &d)
{
! const int n = model.numSubFields();
! num_materials_m = model.numMaterials();
s.physicalCellDomain_m = model.physicalCellDomain();
s.guards_m = model.guardLayers();
s.centering_m = model.centering();
*************** public:
*** 436,442 ****
}
else
{
- num_materials_m = model.numMaterials();
s.addSubFields(n);
for (int i = 0; i < n; i++)
initialize(s.subFields_m[i], model.subField(i), d);
--- 438,443 ----
*************** public:
*** 466,471 ****
--- 467,473 ----
}
}
+ // FIXME: This function is deprecated.
inline int numSubFields() const
{
return subFields_m.size();
*************** public:
*** 521,531 ****
return guards_m;
}
- inline int centeringSize() const
- {
- return centering_m.size();
- }
-
inline int numMaterials() const
{
return num_materials_m;
--- 523,528 ----
*************** public:
*** 573,578 ****
--- 570,580 ----
{
return centering_m;
}
+
+ inline int centeringSize() const
+ {
+ return centering_m.size();
+ }
//---------------------------------------------------------------------------
// Make a distinct copy of this fieldEngineBase.
Index: Mesh/UniformRectilinearMesh.h
===================================================================
RCS file: /home/pooma/Repository/r2/src/NewField/Mesh/Attic/UniformRectilinearMesh.h,v
retrieving revision 1.1.2.2
diff -c -p -r1.1.2.2 UniformRectilinearMesh.h
*** Mesh/UniformRectilinearMesh.h 2001/08/08 15:17:19 1.1.2.2
--- Mesh/UniformRectilinearMesh.h 2001/08/14 19:58:26
*************** public:
*** 289,295 ****
{
for (int i = 0; i < Dim; i++)
origin_m(i) += spacings_m(i) *
! (c.positions()[0] - m.physicalCellDomain[i].first());
}
PointType_t operator()(int i0) const
--- 289,295 ----
{
for (int i = 0; i < Dim; i++)
origin_m(i) += spacings_m(i) *
! (c.position(0) - m.physicalCellDomain[i].first());
}
PointType_t operator()(int i0) const
Index: Updater/ConstantFaceBC.h
===================================================================
RCS file: /home/pooma/Repository/r2/src/NewField/Updater/ConstantFaceBC.h,v
retrieving revision 1.4
diff -c -p -r1.4 ConstantFaceBC.h
*** Updater/ConstantFaceBC.h 2001/04/27 22:55:55 1.4
--- Updater/ConstantFaceBC.h 2001/08/14 19:58:26
*************** public:
*** 155,163 ****
: Base_t(s, bc),
domain_m(Pooma::NoInit())
{
! // This only makes sense if the subject has no sub-fields.
! PAssert(subject().numSubFields() == 0);
// Set up the domain.
--- 155,163 ----
: Base_t(s, bc),
domain_m(Pooma::NoInit())
{
! // These versions only work with fields with one value per cell.
! PAssert(subject().numMaterials() <= 1 && subject().centering().size() <= 1);
// Set up the domain.
Index: Updater/PeriodicFaceBC.cpp
===================================================================
RCS file: /home/pooma/Repository/r2/src/NewField/Updater/PeriodicFaceBC.cpp,v
retrieving revision 1.1
diff -c -p -r1.1 PeriodicFaceBC.cpp
*** Updater/PeriodicFaceBC.cpp 2000/10/24 15:11:02 1.1
--- Updater/PeriodicFaceBC.cpp 2001/08/14 19:58:26
*************** Updater(const Subject_t &s, const Period
*** 51,128 ****
: Base_t(s, bc),
domain_m(Pooma::NoInit())
{
! // This only makes sense if the subject has no sub-fields.
! PAssert(subject().numSubFields() == 0);
! // Set up the domain.
! domain_m = subject().totalDomain();
! // Get the direction.
! int d = bc.face() / 2;
! int adjust;
! bool VertFace = subject().fieldEngine().offsets()[d] == 1;
! if (VertFace) {
! adjust = 1;
! }
! else {
! adjust = 0;
! }
!
! // Select the high or low face:
!
! if (bc.face() & 1) {
!
! // High face.
!
! // Get the number of guard layers in the upper direction.
! int nGuards = subject().fieldEngine().guardLayers().upper(d);
!
! // For Vert centering, because boundary is at last physical vertex,
! // which is identified with the first physical vertex, destination
! // domain is extended to includes last physical vertex:
! domain_m[d] =
! Interval<1>(domain_m[d].max() - (nGuards - 1 + adjust),
! domain_m[d].max());
!
! // N.B.: only do this here on the High face; don't do it again down
! // below on the low face. This follows the convention of r1.
!
! // Source domain is just the destination domain offset by the
! // periodicity length (number of *cells*):
! srcDomain_m[d] =
! Interval<1>(domain_m[d].min() -
! (subject().physicalDomain()[d].length() - adjust),
! domain_m[d].max() -
! (subject().physicalDomain()[d].length() - adjust));
!
! } else {
!
! // Low face.
!
! // Get the number of guard layers in the lower direction.
! int nGuards = subject().fieldEngine().guardLayers().lower(d);
!
! // For Vert centering, because boundary is at first physical vertex,
! // which
! // is identified with the last physical vertex, destination domain is
! // extended to includes first physical vertex. However, *don't*
! // include the first physical vertex here on the Low face; see notes
! // above regarding the High face (following r1 convention):
! domain_m[d] =
! Interval<1>(
! domain_m[d].min() + (nGuards - 1));
!
! // Source domain is just the destination domain offset by the
! // periodicity length (number of *cells*):
! srcDomain_m[d] =
! Interval<1>(domain_m[d].min() +
! (subject().physicalDomain()[d].length() - adjust),
! domain_m[d].max() +
! (subject().physicalDomain()[d].length() - adjust));
! }
}
--- 51,128 ----
: Base_t(s, bc),
domain_m(Pooma::NoInit())
{
! // These versions only work with fields with one value per cell.
! PAssert(f.numMaterials() <= 1 && f.centering().size() <= 1);
! // Set up the domain.
! domain_m = subject().totalDomain();
! // Get the direction.
! int d = bc.face() / 2;
! int adjust;
! bool VertFace = subject().fieldEngine().offsets()[d] == 1;
! if (VertFace) {
! adjust = 1;
! }
! else {
! adjust = 0;
! }
!
! // Select the high or low face:
!
! if (bc.face() & 1) {
!
! // High face.
!
! // Get the number of guard layers in the upper direction.
! int nGuards = subject().fieldEngine().guardLayers().upper(d);
!
! // For Vert centering, because boundary is at last physical vertex,
! // which is identified with the first physical vertex, destination
! // domain is extended to includes last physical vertex:
! domain_m[d] =
! Interval<1>(domain_m[d].max() - (nGuards - 1 + adjust),
! domain_m[d].max());
!
! // N.B.: only do this here on the High face; don't do it again down
! // below on the low face. This follows the convention of r1.
!
! // Source domain is just the destination domain offset by the
! // periodicity length (number of *cells*):
! srcDomain_m[d] =
! Interval<1>(domain_m[d].min() -
! (subject().physicalDomain()[d].length() - adjust),
! domain_m[d].max() -
! (subject().physicalDomain()[d].length() - adjust));
!
! } else {
!
! // Low face.
!
! // Get the number of guard layers in the lower direction.
! int nGuards = subject().fieldEngine().guardLayers().lower(d);
!
! // For Vert centering, because boundary is at first physical vertex,
! // which
! // is identified with the last physical vertex, destination domain is
! // extended to includes first physical vertex. However, *don't*
! // include the first physical vertex here on the Low face; see notes
! // above regarding the High face (following r1 convention):
! domain_m[d] =
! Interval<1>(
! domain_m[d].min() + (nGuards - 1));
!
! // Source domain is just the destination domain offset by the
! // periodicity length (number of *cells*):
! srcDomain_m[d] =
! Interval<1>(domain_m[d].min() +
! (subject().physicalDomain()[d].length() - adjust),
! domain_m[d].max() +
! (subject().physicalDomain()[d].length() - adjust));
! }
}
Index: Updater/PosReflectFaceBC.cpp
===================================================================
RCS file: /home/pooma/Repository/r2/src/NewField/Updater/PosReflectFaceBC.cpp,v
retrieving revision 1.1
diff -c -p -r1.1 PosReflectFaceBC.cpp
*** Updater/PosReflectFaceBC.cpp 2000/10/24 15:11:02 1.1
--- Updater/PosReflectFaceBC.cpp 2001/08/14 19:58:26
*************** Updater(const Subject_t &s, const PosRef
*** 42,123 ****
: Base_t(s, bc),
domain_m(Pooma::NoInit())
{
! // This only makes sense if the subject has no sub-fields.
! PAssert(subject().numSubFields() == 0);
! // Set up the domain.
! domain_m = subject().totalDomain();
! // Note: a convertor from Interval<Dim> Range<Dim> would be handy
! // here:
! // srcRange is used to get data to copy from
! for (int dd = 0; dd < Subject_t::dimensions; ++dd) {
! srcRange_m[dd] =
! Range<1>(domain_m[dd].min(), domain_m[dd].max(), 1);
! }
! // range that needs to be zeroed when enforceZeroBoundary_m is true
! vertFaceDomain_m = subject().totalDomain();
! // Get the direction.
! int d = bc.face() / 2;
! // The other directions span the subject's total domain.
! // Therefore, we just chop out the guard layers, taking care to
! // handle the case where we are enforcing a zero boundary
! // (appropriate only for vert-centering).
! int adjust;
! bool VertFace = subject().fieldEngine().offsets()[d] == 1;
! if (VertFace) {
! adjust = 1;
! }
! else {
! adjust = 0;
! }
! // Select the high or low face.
! if (bc.face() & 1) {
! // High face.
! // Get the number of guard layers in the upper direction.
! int nGuards = subject().fieldEngine().guardLayers().upper(d);
! if (bc.enforceZeroBoundary() && VertFace) {
! vertFaceDomain_m[d]
! = Interval<1>(subject().physicalDomain()[d].max(),
! subject().physicalDomain()[d].max());
! }
! srcRange_m[d] =
! Range<1>(subject().physicalDomain()[d].max() - adjust,
! subject().physicalDomain()[d].max() - adjust -
! (nGuards - 1),
! -1);
! // Adjust the domain.
! domain_m[d] = Interval<1>(domain_m[d].max() - (nGuards - 1),
! domain_m[d].max());
! }
! else {
! // Low face.
! // Get the number of guard layers in the lower direction.
! int nGuards = subject().fieldEngine().guardLayers().lower(d);
! // other directions span the subject's total domain.
! // Therefore, we
! // just chop out the guard layers, taking care to handle the case
! // where we are enforcing a zero boundary (appropriate only for
! // vert-centering).
! if (bc.enforceZeroBoundary() && VertFace) {
! vertFaceDomain_m[d] =
! Interval<1>(subject().physicalDomain()[d].min(),
! subject().physicalDomain()[d].min());
! }
! // Adjust the domains.
! srcRange_m[d] =
! Range<1>(subject().physicalDomain()[d].min() + adjust +
! (nGuards - 1),
! subject().physicalDomain()[d].min() + adjust, -1);
! domain_m[d] = Interval<1>(domain_m[d].min(),
! domain_m[d].min() + (nGuards - 1));
! }
}
//-----------------------------------------------------------------------------
--- 42,123 ----
: Base_t(s, bc),
domain_m(Pooma::NoInit())
{
! // These versions only work with fields with one value per cell.
! PAssert(subject().numMaterials() <= 1 && subject().centering().size() <= 1);
! // Set up the domain.
! domain_m = subject().totalDomain();
! // Note: a convertor from Interval<Dim> Range<Dim> would be handy
! // here:
! // srcRange is used to get data to copy from
! for (int dd = 0; dd < Subject_t::dimensions; ++dd) {
! srcRange_m[dd] =
! Range<1>(domain_m[dd].min(), domain_m[dd].max(), 1);
! }
! // range that needs to be zeroed when enforceZeroBoundary_m is true
! vertFaceDomain_m = subject().totalDomain();
! // Get the direction.
! int d = bc.face() / 2;
! // The other directions span the subject's total domain.
! // Therefore, we just chop out the guard layers, taking care to
! // handle the case where we are enforcing a zero boundary
! // (appropriate only for vert-centering).
! int adjust;
! bool VertFace = subject().fieldEngine().offsets()[d] == 1;
! if (VertFace) {
! adjust = 1;
! }
! else {
! adjust = 0;
! }
! // Select the high or low face.
! if (bc.face() & 1) {
! // High face.
! // Get the number of guard layers in the upper direction.
! int nGuards = subject().fieldEngine().guardLayers().upper(d);
! if (bc.enforceZeroBoundary() && VertFace) {
! vertFaceDomain_m[d]
! = Interval<1>(subject().physicalDomain()[d].max(),
! subject().physicalDomain()[d].max());
! }
! srcRange_m[d] =
! Range<1>(subject().physicalDomain()[d].max() - adjust,
! subject().physicalDomain()[d].max() - adjust -
! (nGuards - 1),
! -1);
! // Adjust the domain.
! domain_m[d] = Interval<1>(domain_m[d].max() - (nGuards - 1),
! domain_m[d].max());
! }
! else {
! // Low face.
! // Get the number of guard layers in the lower direction.
! int nGuards = subject().fieldEngine().guardLayers().lower(d);
! // other directions span the subject's total domain.
! // Therefore, we
! // just chop out the guard layers, taking care to handle the case
! // where we are enforcing a zero boundary (appropriate only for
! // vert-centering).
! if (bc.enforceZeroBoundary() && VertFace) {
! vertFaceDomain_m[d] =
! Interval<1>(subject().physicalDomain()[d].min(),
! subject().physicalDomain()[d].min());
! }
! // Adjust the domains.
! srcRange_m[d] =
! Range<1>(subject().physicalDomain()[d].min() + adjust +
! (nGuards - 1),
! subject().physicalDomain()[d].min() + adjust, -1);
! domain_m[d] = Interval<1>(domain_m[d].min(),
! domain_m[d].min() + (nGuards - 1));
! }
}
//-----------------------------------------------------------------------------
Index: tests/NearestNeighbors.cpp
===================================================================
RCS file: /home/pooma/Repository/r2/src/NewField/tests/Attic/NearestNeighbors.cpp,v
retrieving revision 1.1.2.1
diff -c -p -r1.1.2.1 NearestNeighbors.cpp
*** tests/NearestNeighbors.cpp 2001/08/02 22:36:56 1.1.2.1
--- tests/NearestNeighbors.cpp 2001/08/14 19:58:27
*************** checkFieldOffset(Pooma::Tester &tester,
*** 75,81 ****
const FieldOffset<Dim> &offset,
const bool offsetPresent = true)
{
! PInsist(listNum >= 0 && listNum < nnSize,
"Incorrect std::vector<FieldOffsetList> index.");
return
--- 75,81 ----
const FieldOffset<Dim> &offset,
const bool offsetPresent = true)
{
! PInsist(listNum < nnSize,
"Incorrect std::vector<FieldOffsetList> index.");
return
*************** manhattanDistance(const Centering<Dim> &
*** 111,123 ****
const int outputIndex)
{
// Compute the actual input position.
! Loc<Dim> cellOffset = offset.cellOffset();
! Vector<Dim> input =
! inputCentering.positions()[offset.subFieldNumber()];
! for (int index = Dim-1; index >= 0; --index)
! input(index) += cellOffset[index].first();
!
! return manhattanDistance(outputCentering.positions()[outputIndex] - input);
}
// Check that the distance between the input and output values are the
--- 111,118 ----
const int outputIndex)
{
// Compute the actual input position.
! return manhattanDistance(outputCentering.position(outputIndex) -
! inputPosition(inputCentering, offset));
}
// Check that the distance between the input and output values are the
Index: tests/makefile
===================================================================
RCS file: /home/pooma/Repository/r2/src/NewField/tests/makefile,v
retrieving revision 1.11.2.7
diff -c -p -r1.11.2.7 makefile
*** tests/makefile 2001/08/13 21:14:31 1.11.2.7
--- tests/makefile 2001/08/14 19:58:27
*************** run: run_tests
*** 47,53 ****
run_tests: tests
$(ODIR)/BasicTest1 $(TSTOPTS) 1>BasicTest1.out 2>&1
$(ODIR)/BasicTest2 $(TSTOPTS) 1>BasicTest2.out 2>&1
- $(ODIR)/MeshTest1 $(TSTOPTS) 1>MeshTest1.out 2>&1
$(ODIR)/Centerings $(TSTOPTS) 1>Centerings.out 2>&1
$(ODIR)/ExpressionTest $(TSTOPTS) 1>ExpressionTest.out 2>&1
$(ODIR)/FieldOffset $(TSTOPTS) 1>FieldOffset.out 2>&1
--- 47,52 ----
*************** run_tests: tests
*** 55,72 ****
$(ODIR)/FieldTour1 $(TSTOPTS) 1>FieldTour1.out 2>&1
$(ODIR)/FieldTour2 $(TSTOPTS) 1>FieldTour2.out 2>&1
$(ODIR)/FieldTour3 $(TSTOPTS) 1>FieldTour3.out 2>&1
$(ODIR)/NearestNeighbors $(TSTOPTS) 1>NearestNeighbors.out 2>&1
$(ODIR)/ScalarCode $(TSTOPTS) 1>ScalarCode.out 2>&1
$(ODIR)/StencilTests $(TSTOPTS) 1>StencilTests.out 2>&1
$(ODIR)/VectorTest $(TSTOPTS) 1>VectorTest.out 2>&1
$(ODIR)/WhereTest $(TSTOPTS) 1>WhereTest.out 2>&1
! field_tests:: $(ODIR)/BasicTest1 $(ODIR)/BasicTest2 $(ODIR)/MeshTest1 \
$(ODIR)/Centerings $(ODIR)/ExpressionTest \
$(ODIR)/FieldOffset $(ODIR)/FieldReductions \
$(ODIR)/FieldTour1 $(ODIR)/FieldTour2 \
! $(ODIR)/FieldTour3 \
! $(ODIR)/NearestNeighbors \
$(ODIR)/ScalarCode $(ODIR)/StencilTests \
$(ODIR)/VectorTest $(ODIR)/WhereTest
--- 54,73 ----
$(ODIR)/FieldTour1 $(TSTOPTS) 1>FieldTour1.out 2>&1
$(ODIR)/FieldTour2 $(TSTOPTS) 1>FieldTour2.out 2>&1
$(ODIR)/FieldTour3 $(TSTOPTS) 1>FieldTour3.out 2>&1
+ $(ODIR)/Gradient $(TSTOPTS) 1>Gradient.out 2>&1
+ $(ODIR)/MeshTest1 $(TSTOPTS) 1>MeshTest1.out 2>&1
$(ODIR)/NearestNeighbors $(TSTOPTS) 1>NearestNeighbors.out 2>&1
$(ODIR)/ScalarCode $(TSTOPTS) 1>ScalarCode.out 2>&1
$(ODIR)/StencilTests $(TSTOPTS) 1>StencilTests.out 2>&1
$(ODIR)/VectorTest $(TSTOPTS) 1>VectorTest.out 2>&1
$(ODIR)/WhereTest $(TSTOPTS) 1>WhereTest.out 2>&1
! field_tests:: $(ODIR)/BasicTest1 $(ODIR)/BasicTest2 \
$(ODIR)/Centerings $(ODIR)/ExpressionTest \
$(ODIR)/FieldOffset $(ODIR)/FieldReductions \
$(ODIR)/FieldTour1 $(ODIR)/FieldTour2 \
! $(ODIR)/FieldTour3 $(ODIR)/Gradient\
! $(ODIR)/MeshTest1 $(ODIR)/NearestNeighbors \
$(ODIR)/ScalarCode $(ODIR)/StencilTests \
$(ODIR)/VectorTest $(ODIR)/WhereTest
More information about the pooma-dev
mailing list