* (EPS) without the need for another graphics tool.
* #write_epsgrid# writes just the 2d grid - This is obsolete and
* should be removed. The functionality is provided through #write_eps#
- * and #eps_output_data# now.
+ * and #EpsOutputData# now.
* #write_eps# can use one data vector for height information and one
* cell vector for shading information. Control is done through an
- * object of class #eps_output_data# as follows.
+ * object of class #EpsOutputData# as follows.
*
* Vectors are added as usual by #add_data_vector#. Then one has to
* decide, wether to produce a 2D or 3D plot. This is done by setting
* default constructed object is used.
*/
void write_eps (ostream &out,
- const eps_output_data &EOD = eps_output_data()) const;
+ const EpsOutputData &eod = EpsOutputData()) const;
/**
* Write grid in Encapsulated
* Class of data for vertices
* for eps output.
*/
- class eps_vertex_data{
+ class EpsVertexData{
public:
/**
* Coordinates
* Default Constructor;
* needed for STL.
*/
- eps_vertex_data()
+ EpsVertexData()
{};
/**
* Constructor that takes three
* coordinate values as argument.
*/
- eps_vertex_data(double a, double b, double c):x(a),y(b),z(c)
+ EpsVertexData(double a, double b, double c):x(a),y(b),z(c)
{};
/**
* projection and output. Because of this all
* output data is put into a STL multiset.
*/
- class eps_cell_data{
+ class EpsCellData{
public:
/**
* STL-vector of vertices
*/
- vector<eps_vertex_data> vertices;
+ EpsVertexData vertices[4];
/**
* Color values
* Comparison operator for
* sorting
*/
- bool operator < (const eps_cell_data &) const;
+ bool operator < (const EpsCellData &) const;
};
};
* documentation of class DataOut for
* description.
*/
-class eps_output_data{
+class EpsOutputData{
public:
/**
* Different types of
* colorization
*/
- typedef enum {None,Vector,Shaded,Black,White} color_type;
+ typedef enum {None,Vector,Shaded,Black,White} ColorType;
/**
* Type of height information
*/
- color_type height_type;
+ ColorType height_type;
/**
* Cell shading
*/
- color_type cell_type;
+ ColorType cell_type;
/**
* Boundary color
*/
- color_type cell_boundary_type;
+ ColorType cell_boundary_type;
/**
* Vector with height information
/**
* Default constructor
*/
- eps_output_data();
+ EpsOutputData();
/**
* Color scaling
template <>
-void DataOut<2>::write_eps (ostream &out, const eps_output_data &EOD) const {
+void DataOut<2>::write_eps (ostream &out, const EpsOutputData &eod) const {
Assert (dofs != 0, ExcNoDoFHandlerSelected());
{
// copying them to a multiset.
// Perform the necessary turn.
DoFHandler<2>::active_cell_iterator endc = dofs->end();
- unsigned cell_index=0;
- multiset<DataOut<2>::eps_cell_data> cells;
- multiset<DataOut<2>::eps_cell_data> cells2;
+ multiset<DataOut<2>::EpsCellData> cells;
+ multiset<DataOut<2>::EpsCellData> cells2;
- bool cell_data_p = ((cell_data.size())>0) && (EOD.cell_type == EOD.Vector);
+ bool cell_data_p = ((cell_data.size())>0) && (eod.cell_type == EpsOutputData::Vector);
- for(DoFHandler<2>::active_cell_iterator cell=dofs->begin_active();
- cell!=endc; ++cell, ++cell_index)
+ unsigned cell_index;
+ DoFHandler<2>::active_cell_iterator cell;
+ for(cell_index=0, cell=dofs->begin_active();
+ cell!=endc;
+ ++cell, ++cell_index)
{
- eps_cell_data cd;
- cd.vertices.resize(4);
- for (unsigned int i=0; i<4; i++)
+ EpsCellData cd;
+ for (unsigned int i=0; i<4; ++i)
{
(cd.vertices[i]).x=cell->vertex(i)(0);
(cd.vertices[i]).y=cell->vertex(i)(1);
- switch (EOD.height_type)
+ switch (eod.height_type)
{
- case EOD.Vector:
- (cd.vertices[i]).z=(*dof_data[EOD.height_vector].data)(cell->vertex_dof_index(i,0));
+ case EpsOutputData::Vector:
+ (cd.vertices[i]).z=(*dof_data[eod.height_vector].data)(cell->vertex_dof_index(i,0));
break;
- case EOD.None:
+ case EpsOutputData::None:
(cd.vertices[i]).z=0;
break;
default:
};
};
- if (EOD.height_type==EOD.Vector)
- cd.turn(EOD.azimuth,EOD.elevation);
+ if (eod.height_type==EpsOutputData::Vector)
+ cd.turn(eod.azimuth,eod.elevation);
if (cell_data_p)
- cd.red=(*cell_data[EOD.cell_vector].data)(cell_index);
+ cd.red=(*cell_data[eod.cell_vector].data)(cell_index);
cells.insert(cd);
};
// multiset cells. First we look
// for extrema.
-
- double xvv,yvv,cvv;
double xmin=cells.begin()->vertices[0].x;
double xmax=xmin;
double ymin=cells.begin()->vertices[0].y;
float cell_vector_min=cells.begin()->red;
float cell_vector_max=cell_vector_min;
- for(typename multiset<DataOut<2>::eps_cell_data>::iterator c=cells.begin();
+ for(typename multiset<DataOut<2>::EpsCellData>::iterator c=cells.begin();
c!=cells.end(); ++c, ++cell_index)
{
- for (unsigned int i=0; i<4; i++)
+ for (unsigned int i=0; i<4; ++i)
{
+ double xvv,yvv;
xvv=c->vertices[i].x;
xmin=(xmin < xvv ? xmin : xvv);
xmax=(xmax > xvv ? xmax : xvv);
}
if (cell_data_p)
{
+ double cvv;
cvv = c->red;
cell_vector_max = (cell_vector_max > cvv ? cell_vector_max : cvv);
cell_vector_min = (cell_vector_min < cvv ? cell_vector_min : cvv);
// If we want shaded output we can
// do the shading now.
- if (EOD.cell_type==EOD.Shaded)
+ if (eod.cell_type==EpsOutputData::Shaded)
{
double spann1[3], spann2[3], normal[3];
double light_norm, normal_norm;
float color;
- for (typename multiset<DataOut<2>::eps_cell_data>::iterator c=cells.begin();c!=cells.end();c++)
+ for (typename multiset<DataOut<2>::EpsCellData>::iterator c=cells.begin();c!=cells.end();++c)
{
- eps_cell_data cd(*c);
+ EpsCellData cd(*c);
spann1[0]=spann2[0]=cd.vertices[0].x;
spann1[1]=spann2[1]=cd.vertices[0].y;
normal[2] = spann1[0]*spann2[1]-spann1[1]*spann2[0];
normal_norm = sqrt(normal[0]*normal[0]+normal[1]*normal[1]+normal[2]*normal[2]);
- light_norm = sqrt(EOD.light[0]*EOD.light[0]+EOD.light[1]*EOD.light[1]+EOD.light[2]*EOD.light[2]);
+ light_norm = sqrt(eod.light[0]*eod.light[0]+eod.light[1]*eod.light[1]+eod.light[2]*eod.light[2]);
- color = EOD.light[0]*normal[0]+EOD.light[1]*normal[1]+EOD.light[2]*normal[2];
+ color = eod.light[0]*normal[0]+eod.light[1]*normal[1]+eod.light[2]*normal[2];
color /= light_norm * normal_norm;
cd.red=color;
// this so that it is in the range
// between 0 and 1.
- double xscale = 300 / (xmax-xmin);
- double yscale = 300 / (ymax-ymin);
- double scale = (xscale < yscale ? xscale : yscale);
+ const double scale = 300 / (xmax-xmin > ymax-ymin ? xmax-xmin : ymax-ymin);
cells.clear();
-
- for (typename multiset<DataOut<2>::eps_cell_data>::iterator c=cells2.begin();
+ for (typename multiset<DataOut<2>::EpsCellData>::iterator c=cells2.begin();
c!=cells2.end(); ++c)
{
- eps_cell_data cd (*c);
- for (unsigned int i=0; i<4; i++)
+ EpsCellData cd (*c);
+ for (unsigned int i=0; i<4; ++i)
{
cd.vertices[i].x=(cd.vertices[i].x-xmin)*scale;
cd.vertices[i].y=(cd.vertices[i].y-ymin)*scale;
};
if (cell_data_p)
- EOD.color(cd.red,cell_vector_max,cell_vector_min,cd.red,cd.green,cd.blue);
+ eod.color(cd.red,cell_vector_max,cell_vector_min,cd.red,cd.green,cd.blue);
cells.insert(cd);
};
// Now we are ready to output...
- cell_data_p = cell_data_p || (EOD.cell_type==EOD.Shaded);
+ cell_data_p = cell_data_p || (eod.cell_type==EpsOutputData::Shaded);
- for (typename multiset<DataOut<2>::eps_cell_data>::iterator c=cells.begin();
+ for (typename multiset<DataOut<2>::EpsCellData>::iterator c=cells.begin();
c!=cells.end(); ++c)
{
if (cell_data_p)
<< " closepath fill" << endl;
};
- if (EOD.cell_boundary_type == EOD.Black ||
- EOD.cell_boundary_type == EOD.White)
+ if (eod.cell_boundary_type == EpsOutputData::Black ||
+ eod.cell_boundary_type == EpsOutputData::White)
{
- switch (EOD.cell_boundary_type)
+ switch (eod.cell_boundary_type)
{
- case EOD.Black:
+ case EpsOutputData::Black:
out << "0";
break;
- case EOD.White:
+ case EpsOutputData::White:
out << "1";
break;
default:
template <int dim>
-void DataOut<dim>::write_eps (ostream &/*out*/,
- const eps_output_data &/*EOD*/) const {
+void DataOut<dim>::write_eps (ostream &,
+ const EpsOutputData &) const{
// this is for all other dimensions that
// are not explicitely specialized
Assert (false, ExcNotImplemented());
template<int dim>
-bool DataOut<dim>::eps_cell_data::operator < (const eps_cell_data &other) const
+bool DataOut<dim>::EpsCellData::operator < (const EpsCellData &other) const
{
double maxz = vertices[0].z,
othermaxz = other.vertices[0].z;
unsigned i;
- for (i=1; i<4; i++)
+ for (i=1; i<4; ++i)
{
maxz = (maxz > vertices[i].z ? maxz : vertices[i].z);
othermaxz = (othermaxz > other.vertices[i].z ? othermaxz : other.vertices[i].z);
template <int dim>
-void DataOut<dim>::eps_vertex_data::turn(double azi, double ele)
+void DataOut<dim>::EpsVertexData::turn(double azi, double ele)
{
double nx,ny,nz;
template <int dim>
-void DataOut<dim>::eps_cell_data::turn(double azi, double ele)
+void DataOut<dim>::EpsCellData::turn(double azi, double ele)
{
- for (unsigned i=0; i<4; i++)
+ for (unsigned i=0; i<4; ++i)
vertices[i].turn(azi,ele);
};
-eps_output_data::eps_output_data()
+EpsOutputData::EpsOutputData()
: height_type(None),
cell_type(None),
cell_boundary_type (Black),
// { 0 (3) - (4)
// { ( 4*x- xmin-3*xmax)/(xmax-xmin) (4) - (5)
-void eps_output_data::color(const float x, const float xmax, const float xmin,
+void EpsOutputData::color(const float x, const float xmax, const float xmin,
float &r, float &g, float &b) const
{
float sum = xmax+ xmin;