[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Freepooma-devel] [PATCH] Add slice viewing to Fields
From: |
Richard Guenther |
Subject: |
[Freepooma-devel] [PATCH] Add slice viewing to Fields |
Date: |
Wed, 13 Apr 2005 20:50:47 +0200 |
User-agent: |
Debian Thunderbird 1.0.2 (X11/20050401) |
This patch adds slice viewing capability to the Field class and
adds a testcase excercising it. Slice viewing is slightly
complicated for Fields, as there we have that weird Centering
stuff. For now, we only can slice for centeringSize() == 1.
Like some other random code in the FieldEngine mess.
Applied to HEAD, queued for r2.
Richard.
2005Apr13 Richard Guenther <address@hidden>
* src/Field/FieldEngine/FieldEngine.h: Add constructors
for taking SliceInterval and SliceRange views.
(initSlice): New common initialization method for slice views.
src/Field/tests/Slice.cpp: New testcase.
src/Field/tests/makefile: Add Slice.
Index: FieldEngine.h
===================================================================
RCS file: /cvsroot/freepooma/freepooma/src/Field/FieldEngine/FieldEngine.h,v
retrieving revision 1.11
diff -u -r1.11 FieldEngine.h
--- FieldEngine.h 10 Nov 2004 22:05:01 -0000 1.11
+++ FieldEngine.h 13 Apr 2005 18:43:20 -0000
@@ -278,7 +278,8 @@
//@}
- /// View constructors.
+ ///@name View constructors.
+ //@{
template<class T2, class EngineTag2>
FieldEngine(const FieldEngine<Mesh, T2, EngineTag2> &model,
@@ -340,6 +341,28 @@
physicalCellDomain_m = mesh_m.physicalCellDomain();
}
+ /// This constructor handles SliceInterval views. For this view
+ /// we get a NoMesh mesh. We can only handle fields with one
+ /// centering point.
+
+ template<class Mesh2, class EngineTag2>
+ FieldEngine(const FieldEngine<Mesh2, T, EngineTag2> &model,
+ const SliceInterval<Mesh2::dimensions, Dim> &d)
+ {
+ initSlice(model, d);
+ }
+
+ /// This constructor handles SliceRange views. For this view
+ /// we get a NoMesh mesh. We can only handle fields with one
+ /// centering point.
+
+ template<class Mesh2, class EngineTag2>
+ FieldEngine(const FieldEngine<Mesh2, T, EngineTag2> &model,
+ const SliceRange<Mesh2::dimensions, Dim> &d)
+ {
+ initSlice(model, d);
+ }
+
template<class T2, class EngineTag2>
FieldEngine(const FieldEngine<Mesh, T2, EngineTag2> &model,
const INode<Dim> &i)
@@ -442,6 +465,8 @@
}
}
+ //@}
+
FieldEngine(const This_t &model,
const Pooma::DontCopyRelations &d)
: num_materials_m(model.numMaterials()),
@@ -738,6 +763,52 @@
private:
+ /// Common initialization for slice views.
+
+ template <class FE, class Domain>
+ void initSlice(const FE& model, const Domain& d)
+ {
+ // We cannot deal with multiple centering points here, as we
+ // really would need to remove some of them(?)
+ PAssert(model.centeringSize() == 1);
+
+ num_materials_m = model.numMaterials();
+ stride_m = 1;
+
+ // First, initialize the centering with a one with
+ // reduced dimensionality. Also handle guards_m and
+ // physicalCellDomain_m here.
+ typename Centering<Dim>::Orientation orientation;
+ typename Centering<Dim>::Position position;
+ int j=0;
+ for (int i=0; i<FE::dimensions; ++i)
+ {
+ if (d.ignorable(i))
+ continue;
+ orientation[j] = model.centering().orientation(0)[i];
+ position(j) = model.centering().position(0)(i);
+ guards_m.lower(j) = model.guardLayers().lower(i);
+ guards_m.upper(j) = model.guardLayers().upper(i);
+ physicalCellDomain_m[j] = model.physicalCellDomain()[i];
+ ++j;
+ }
+ centering_m.addValue(orientation, position);
+
+ // Now we can safely add and initialize our subfields
+ addSubFields();
+ for (int m = 0; m < numMaterials(); ++m)
+ {
+ data(m, 0) = Data_t(model.data(m, 0).engine(), d,
+ model.data(m, 0).relations());
+ }
+
+ // Initialize the mesh from the physical vertex domain
+ // and guards.
+ mesh_m = Mesh(DomainLayout<Dim>(growRight(physicalCellDomain(), 1),
+ guardLayers()));
+ }
+
+
unsigned int num_materials_m;
Centering<Dim> centering_m;
int stride_m;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freepooma-devel] [PATCH] Add slice viewing to Fields,
Richard Guenther <=