]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
eps surface plots in 3d
authorguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 4 Jul 2001 16:07:33 +0000 (16:07 +0000)
committerguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 4 Jul 2001 16:07:33 +0000 (16:07 +0000)
git-svn-id: https://svn.dealii.org/trunk@4813 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/base/source/data_out_base.cc

index 925d9feef1e207311f78628b9f546b0303e22c4d..23c9e68e82b6df6b9ef868d17dae876c44d5a1f8 100644 (file)
@@ -1125,7 +1125,9 @@ void DataOutBase::write_eps (const typename std::vector<Patch<dim,spacedim> > &p
   Assert (out, ExcIO());
   
   Assert (patches.size() > 0, ExcNoPatches());
-  Assert (spacedim==dim, ExcNotImplemented());
+
+                                  // Do ont allow volume rendering
+  Assert (dim<=2, ExcNotImplemented());
   
   switch (dim) 
     {
@@ -1153,6 +1155,11 @@ void DataOutBase::write_eps (const typename std::vector<Patch<dim,spacedim> > &p
                                         // compiler; they are initialized later
        double min_color_value=0, max_color_value=0;
        
+                                        // Array for z-coordinates of points.
+                                        // The elevation determined by a function if spacedim=2
+                                        // or the z-cooridate of the grid point if spacedim=3
+       double heights[4];
+
                                         // compute the cells for output and
                                         // enter them into the set above
                                         // note that since dim==2, we
@@ -1193,23 +1200,38 @@ void DataOutBase::write_eps (const typename std::vector<Patch<dim,spacedim> > &p
                            (patch->vertices[3] * (1-x_frac))) * y_frac1) 
                          };
 
-                 Assert ((flags.height_vector < patch->data.n_rows()) ||
-                         patch->data.n_rows() == 0,
-                         ExcInvalidVectorNumber (flags.height_vector,
+                 switch (spacedim)
+                   {
+                   case 2:
+                     Assert ((flags.height_vector < patch->data.n_rows()) ||
+                             patch->data.n_rows() == 0,
+                             ExcInvalidVectorNumber (flags.height_vector,
                                                  patch->data.n_rows()));
-                 const double heights[4]
-                   = { patch->data.n_rows() != 0 ?
-                       patch->data(flags.height_vector,i*(n_subdivisions+1) + j)       * flags.z_scaling : 0,
+                     heights[0] = patch->data.n_rows() != 0 ?
+                       patch->data(flags.height_vector,i*(n_subdivisions+1) + j) * flags.z_scaling
+                       : 0;
                        
-                       patch->data.n_rows() != 0 ?
-                       patch->data(flags.height_vector,(i+1)*(n_subdivisions+1) + j)   * flags.z_scaling : 0,
+                     heights[1] = patch->data.n_rows() != 0 ?
+                       patch->data(flags.height_vector,(i+1)*(n_subdivisions+1) + j) * flags.z_scaling
+                       : 0;
                        
-                       patch->data.n_rows() != 0 ?
-                       patch->data(flags.height_vector,(i+1)*(n_subdivisions+1) + j+1) * flags.z_scaling : 0,
+                     heights[2] = patch->data.n_rows() != 0 ?
+                       patch->data(flags.height_vector,(i+1)*(n_subdivisions+1) + j+1) * flags.z_scaling
+                       : 0;
                        
-                       patch->data.n_rows() != 0 ?
-                       patch->data(flags.height_vector,i*(n_subdivisions+1) + j+1)     * flags.z_scaling : 0};
-
+                     heights[3] = patch->data.n_rows() != 0 ?
+                       patch->data(flags.height_vector,i*(n_subdivisions+1) + j+1) * flags.z_scaling
+                       : 0;
+                     break;
+                   case 3:
+                                                      // Copy z-coordinates into the height vector
+                     for (unsigned int i=0;i<4;++i)
+                       heights[i] = points[i](2);
+                     break;
+                   default:
+                     Assert(false, ExcNotImplemented());
+                   }
+                 
 
                                                   // now compute the projection of
                                                   // the bilinear cell given by the
@@ -1240,8 +1262,8 @@ void DataOutBase::write_eps (const typename std::vector<Patch<dim,spacedim> > &p
                  for (unsigned int vertex=0; vertex<4; ++vertex)
                    {
                      const double x = points[vertex](0),
-                                  y = points[vertex](1),
-                                  z = -heights[vertex];
+                       y = points[vertex](1),
+                       z = -heights[vertex];
                      
                      eps_cell.vertices[vertex](0) = -   cz*x+   sz*y;
                      eps_cell.vertices[vertex](1) = -cx*sz*x-cx*cz*y-sx*z;

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.