Skip to content
Snippets Groups Projects
Commit fefc09bd authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

tweak 2d graph + other small fixes
parent 065abf9f
Branches
Tags
No related merge requests found
// $Id: VertexArray.cpp,v 1.22 2007-08-27 23:33:48 geuzaine Exp $
// $Id: VertexArray.cpp,v 1.23 2007-09-14 18:51:37 geuzaine Exp $
//
// Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
//
......@@ -27,7 +27,7 @@
extern Context_T CTX;
VertexArray::VertexArray(int numVerticesPerElement, int numElements)
: fill(0), _numVerticesPerElement(numVerticesPerElement)
: _numVerticesPerElement(numVerticesPerElement)
{
int nb = (numElements ? numElements : 1) * numVerticesPerElement;
_vertices.reserve(nb * 3);
......@@ -192,4 +192,3 @@ void VertexArray::sort(double x, double y, double z)
_normals = sortedNormals;
_colors = sortedColors;
}
......@@ -52,8 +52,6 @@ class BarycenterLessThan{
};
class VertexArray{
public:
int fill; // this must/will be removed
private:
int _numVerticesPerElement;
std::vector<float> _vertices;
......
# $Id: Makefile,v 1.163 2007-09-12 20:14:34 geuzaine Exp $
# $Id: Makefile,v 1.164 2007-09-14 18:51:37 geuzaine Exp $
#
# Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
#
......@@ -205,7 +205,8 @@ GModel.o: GModel.cpp GModel.h GVertex.h GEntity.h Range.h SPoint3.h \
../Post/ColorTable.h ../Geo/Geo.h ../Geo/gmshSurface.h \
../DataStr/Tree.h ../DataStr/avl.h ../Geo/SPoint2.h \
../Geo/ExtrudeParams.h ../Geo/GEdge.h ../Post/OctreePost.h \
../Common/Octree.h ../Common/OctreeInternals.h ../Mesh/BackgroundMesh.h
../Common/Octree.h ../Common/OctreeInternals.h ../Mesh/BackgroundMesh.h \
../Common/Message.h
GModelIO_Geo.o: GModelIO_Geo.cpp GModel.h GVertex.h GEntity.h Range.h \
SPoint3.h SBoundingBox3d.h ../Common/VertexArray.h ../Geo/SVector3.h \
../Geo/SPoint3.h ../Common/GmshDefines.h MVertex.h GPoint.h SPoint2.h \
......
// $Id: Graph2D.cpp,v 1.67 2007-09-12 05:08:12 geuzaine Exp $
// $Id: Graph2D.cpp,v 1.68 2007-09-14 18:51:37 geuzaine Exp $
//
// Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
//
......@@ -85,6 +85,8 @@ static bool getGraphData(PView *p, std::vector<double> &x, double &xmin,
bool space = (opt->Type == PViewOptions::Plot2DSpace);
SPoint3 p0;
numy = 0;
for(int i = 0; i < data->getNumElements(); i++){
int dim = data->getDimension(i);
......@@ -97,10 +99,16 @@ static bool getGraphData(PView *p, std::vector<double> &x, double &xmin,
data->getNode(i, j, xyz[0], xyz[1], xyz[2]);
for(int k = 0; k < numComp; k++)
data->getValue(i, j, k, ts, val[k]);
double vx = ComputeScalarRep(3, xyz);
double vy = ComputeScalarRep(numComp, val);
if(space){
x.push_back(vx);
// store offset to origin + distance to first point
if(x.empty()){
p0 = SPoint3(xyz[0], xyz[1], xyz[2]);
x.push_back(ComputeScalarRep(3, xyz));
}
else{
x.push_back(x[0] + p0.distance(SPoint3(xyz[0], xyz[1], xyz[2])));
}
y[0].push_back(vy);
}
else{
......
// $Id: PView.cpp,v 1.8 2007-09-10 04:47:08 geuzaine Exp $
// $Id: PView.cpp,v 1.9 2007-09-14 18:51:37 geuzaine Exp $
//
// Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
//
......@@ -301,13 +301,19 @@ void PView::combine(bool time, int how, bool remove)
bool PView::write(std::string filename, int format, bool append)
{
Msg(STATUS2, "Writing '%s'", filename.c_str());
bool ret;
switch(format){
case 0: return _data->writePOS(filename, false, false, append); // ASCII
case 1: return _data->writePOS(filename, true, false, append); // binary
case 2: return _data->writePOS(filename, false, true, append); // parsed
case 3: return _data->writeSTL(filename);
case 4: return _data->writeTXT(filename);
case 5: return _data->writeMSH(filename);
default: Msg(GERROR, "Unknown view format %d", format); return false;
case 0: ret = _data->writePOS(filename, false, false, append); break; // ASCII
case 1: ret = _data->writePOS(filename, true, false, append); break; // binary
case 2: ret = _data->writePOS(filename, false, true, append); break; // parsed
case 3: ret = _data->writeSTL(filename); break;
case 4: ret = _data->writeTXT(filename); break;
case 5: ret = _data->writeMSH(filename); break;
default: ret = false; Msg(GERROR, "Unknown view format %d", format); break;
}
Msg(STATUS2, "Wrote '%s'", filename.c_str());
return ret;
}
$Id: VERSIONS,v 1.391 2007-09-10 04:47:09 geuzaine Exp $
$Id: VERSIONS,v 1.392 2007-09-14 18:51:37 geuzaine Exp $
2.1.0 (XX): new post-processing database; complete rewrite of
post-processing draing code; improved 2D mesh algorithms; fix for
post-processing drawing code; improved 2D mesh algorithms; fix for
'could not find extruded vertex' bug;
2.0.8 (Jul 13, 2007): unused vertices are not saved in mesh files
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment