On Mon, 11 Apr 2005, Richard Guenther wrote:
On Mon, 11 Apr 2005, Richard Guenther wrote:
On Fri, 1 Apr 2005, Richard Guenther wrote:
Hi!
This patch canonicalizes the handling of hasInternalGuards_m and
hasExternalGuards_m in the various grid layouts. It also disables
optimizing away of internal guards if the partitioner will create
at most one patch.
I believe that the current way of doing things is correct (apart
from not all places being consistent), i.e. have hasInternalGuards
and guards() being consistent. What the Interpolators really
are asking from the Layouts is the maximum supported stencil size,
a thing the layouts cannot answer atm. For this we need to provide
functionality.
Like the attached patch. Roman - does this work for you?
Richard.
2005Apr11 Richard Guenther <address@hidden>
* src/Particles/Interpolation.h (getMaximumStencilWidth):
New function.
src/Particles/InterpolatorCIC.h: Use it, instead of relying
on internal guards.
src/Particles/InterpolatorSUDS.h: Likewise.
------------------------------------------------------------------------
? LINUXgcc
? LINUXgcc-opt
? tests/LINUXgcc
? tests/LINUXgcc-opt
Index: Interpolation.h
===================================================================
RCS file: /cvsroot/freepooma/freepooma/src/Particles/Interpolation.h,v
retrieving revision 1.10
diff -u -r1.10 Interpolation.h
--- Interpolation.h 1 Nov 2004 18:16:59 -0000 1.10
+++ Interpolation.h 11 Apr 2005 12:56:24 -0000
@@ -220,6 +220,25 @@
void setExternalGuards(const Field&, typename Field::Element_t);
+/// getMaximumStencilWidth returns the maximum extent a stencil may
+/// have if operating on the physical domain.
+
+template <class Layout>
+GuardLayers<Layout::dimensions> getMaximumStencilWidth(const Layout& l)
+{
+ GuardLayers<Layout::dimensions> gl = l.externalGuards();
+ if (l.sizeGlobal() > 1) {
+ for (int i=0; i<Layout::dimensions; ++i) {
+ if (l.internalGuards().lower(i) < gl.lower(i))
+ gl.lower(i) = l.internalGuards().lower(i);
+ if (l.internalGuards().upper(i) < gl.upper(i))
+ gl.upper(i) = l.internalGuards().upper(i);
+ }
+ }
+ return gl;
+}
+
+
#include "Particles/Interpolation.cpp"
Index: InterpolatorCIC.h
===================================================================
RCS file: /cvsroot/freepooma/freepooma/src/Particles/InterpolatorCIC.h,v
retrieving revision 1.12
diff -u -r1.12 InterpolatorCIC.h
--- InterpolatorCIC.h 1 Nov 2004 18:16:59 -0000 1.12
+++ InterpolatorCIC.h 11 Apr 2005 12:56:24 -0000
@@ -152,7 +152,7 @@
"Field and Particle Position must have same number of
patches!");
// Check that the Field has adequate guard layers for CIC
- const GuardLayers<Dim>& gl = field.layout().internalGuards();
+ GuardLayers<Dim> gl = getMaximumStencilWidth(field.layout());
for (int d=0; d<Dim; ++d)
{
PInsist(gl.lower(d)>=1 && gl.upper(d)>=1,
@@ -188,7 +188,7 @@
"Field and Particle Position must have same number of
patches!");
// Check that the Field has adequate guard layers for CIC
- const GuardLayers<Dim>& gl = field.layout().internalGuards();
+ GuardLayers<Dim> gl = getMaximumStencilWidth(field.layout());
for (int d=0; d<Dim; ++d)
{
PInsist(gl.lower(d)>=1 && gl.upper(d)>=1,
@@ -231,7 +231,7 @@
"Field and Particle Position must have same number of
patches!");
// Check that the Field has adequate GuardLayers for CIC
- const GuardLayers<Dim>& gl = field.layout().internalGuards();
+ GuardLayers<Dim> gl = getMaximumStencilWidth(field.layout());
for (int d=0; d<Dim; ++d)
{
PInsist(gl.lower(d)>=1 && gl.upper(d)>=1,
@@ -281,7 +281,7 @@
"Field and Particle CacheData must have same number of
patches!");
// Check that the Field has adequate GuardLayers for CIC
- const GuardLayers<Dim>& gl = field.layout().internalGuards();
+ GuardLayers<Dim> gl = getMaximumStencilWidth(field.layout());
for (int d=0; d<Dim; ++d)
{
PInsist(gl.lower(d)>=1 && gl.upper(d)>=1,
@@ -320,7 +320,7 @@
"Field and Particle CacheData must have same number of
patches!");
// Check that the Field has adequate GuardLayers for CIC
- const GuardLayers<Dim>& gl = field.layout().internalGuards();
+ GuardLayers<Dim> gl = getMaximumStencilWidth(field.layout());
for (int d=0; d<Dim; ++d)
{
PInsist(gl.lower(d)>=1 && gl.upper(d)>=1,
@@ -365,7 +365,7 @@
"Field and Particle CacheData must have same number of
patches!");
// Check that the Field has adequate GuardLayers for CIC
- const GuardLayers<Dim>& gl = field.layout().internalGuards();
+ GuardLayers<Dim> gl = getMaximumStencilWidth(field.layout());
for (int d=0; d<Dim; ++d)
{
PInsist(gl.lower(d)>=1 && gl.upper(d)>=1,
@@ -412,7 +412,7 @@
"Field and Particle CacheData must have same number of
patches!");
// Check that the Field has adequate GuardLayers for CIC
- const GuardLayers<Dim>& gl = field.layout().internalGuards();
+ GuardLayers<Dim> gl = getMaximumStencilWidth(field.layout());
for (int d=0; d<Dim; ++d)
{
PInsist(gl.lower(d)>=1 && gl.upper(d)>=1,
@@ -449,7 +449,7 @@
"Field and Particle CacheData must have same number of
patches!");
// Check that the Field has adequate GuardLayers for CIC
- const GuardLayers<Dim>& gl = field.layout().internalGuards();
+ GuardLayers<Dim> gl = getMaximumStencilWidth(field.layout());
for (int d=0; d<Dim; ++d)
{
PInsist(gl.lower(d)>=1 && gl.upper(d)>=1,
@@ -492,7 +492,7 @@
"Field and Particle CacheData must have same number of
patches!");
// Check that the Field has adequate GuardLayers for CIC
- const GuardLayers<Dim>& gl = field.layout().internalGuards();
+ GuardLayers<Dim> gl = getMaximumStencilWidth(field.layout());
for (int d=0; d<Dim; ++d)
{
PInsist(gl.lower(d)>=1 && gl.upper(d)>=1,
Index: InterpolatorSUDS.h
===================================================================
RCS file:
/cvsroot/freepooma/freepooma/src/Particles/InterpolatorSUDS.h,v
retrieving revision 1.12
diff -u -r1.12 InterpolatorSUDS.h
--- InterpolatorSUDS.h 1 Nov 2004 18:16:59 -0000 1.12
+++ InterpolatorSUDS.h 11 Apr 2005 12:56:24 -0000
@@ -153,7 +153,7 @@
"Field and Particle Position must have same number of
patches!");
// Check that the Field has adequate guard layers for SUDS
- const GuardLayers<Dim>& gl = field.layout().internalGuards();
+ GuardLayers<Dim> gl = getMaximumStencilWidth(field.layout());
for (int d=0; d<Dim; ++d)
{
PInsist(gl.lower(d)>=1 && gl.upper(d)>=1,
@@ -189,7 +189,7 @@
"Field and Particle Position must have same number of
patches!");
// Check that the Field has adequate guard layers for SUDS
- const GuardLayers<Dim>& gl = field.layout().internalGuards();
+ GuardLayers<Dim> gl = getMaximumStencilWidth(field.layout());
for (int d=0; d<Dim; ++d)
{
PInsist(gl.lower(d)>=1 && gl.upper(d)>=1,
@@ -232,7 +232,7 @@
"Field and Particle Position must have same number of
patches!");
// Check that the Field has adequate GuardLayers for SUDS
- const GuardLayers<Dim>& gl = field.layout().internalGuards();
+ GuardLayers<Dim> gl = getMaximumStencilWidth(field.layout());
for (int d=0; d<Dim; ++d)
{
PInsist(gl.lower(d)>=1 && gl.upper(d)>=1,
@@ -282,7 +282,7 @@
"Field and Particle CacheData must have same number of
patches!");
// Check that the Field has adequate GuardLayers for SUDS
- const GuardLayers<Dim>& gl = field.layout().internalGuards();
+ GuardLayers<Dim> gl = getMaximumStencilWidth(field.layout());
for (int d=0; d<Dim; ++d)
{
PInsist(gl.lower(d)>=1 && gl.upper(d)>=1,
@@ -321,7 +321,7 @@
"Field and Particle CacheData must have same number of
patches!");
// Check that the Field has adequate GuardLayers for SUDS
- const GuardLayers<Dim>& gl = field.layout().internalGuards();
+ GuardLayers<Dim> gl = getMaximumStencilWidth(field.layout());
for (int d=0; d<Dim; ++d)
{
PInsist(gl.lower(d)>=1 && gl.upper(d)>=1,
@@ -366,7 +366,7 @@
"Field and Particle CacheData must have same number of
patches!");
// Check that the Field has adequate GuardLayers for SUDS
- const GuardLayers<Dim>& gl = field.layout().internalGuards();
+ GuardLayers<Dim> gl = getMaximumStencilWidth(field.layout());
for (int d=0; d<Dim; ++d)
{
PInsist(gl.lower(d)>=1 && gl.upper(d)>=1,
@@ -413,7 +413,7 @@
"Field and Particle CacheData must have same number of
patches!");
// Check that the Field has adequate GuardLayers for SUDS
- const GuardLayers<Dim>& gl = field.layout().internalGuards();
+ GuardLayers<Dim> gl = getMaximumStencilWidth(field.layout());
for (int d=0; d<Dim; ++d)
{
PInsist(gl.lower(d)>=1 && gl.upper(d)>=1,
@@ -450,7 +450,7 @@
"Field and Particle CacheData must have same number of
patches!");
// Check that the Field has adequate GuardLayers for SUDS
- const GuardLayers<Dim>& gl = field.layout().internalGuards();
+ GuardLayers<Dim> gl = getMaximumStencilWidth(field.layout());
for (int d=0; d<Dim; ++d)
{
PInsist(gl.lower(d)>=1 && gl.upper(d)>=1,
@@ -493,7 +493,7 @@
"Field and Particle CacheData must have same number of
patches!");
// Check that the Field has adequate GuardLayers for SUDS
- const GuardLayers<Dim>& gl = field.layout().internalGuards();
+ GuardLayers<Dim> gl = getMaximumStencilWidth(field.layout());
for (int d=0; d<Dim; ++d)
{
PInsist(gl.lower(d)>=1 && gl.upper(d)>=1,
------------------------------------------------------------------------
_______________________________________________
Freepooma-devel mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/freepooma-devel