diff --git a/Geo/MVertex.h b/Geo/MVertex.h index b3b1cabf2589d11fb3f9ce23e346373fdd4798dd..092998579752b23eb28460b89978b1572f1c4b49 100644 --- a/Geo/MVertex.h +++ b/Geo/MVertex.h @@ -42,11 +42,10 @@ class MVertex{ char _visible, _order; double _x, _y, _z; GEntity *_ge; - //void *_data; public : MVertex(double x, double y, double z, GEntity *ge=0, int num=0) - : _visible(true), _order(1), _x(x), _y(y), _z(z), _ge(ge) //, _data(0) + : _visible(true), _order(1), _x(x), _y(y), _z(z), _ge(ge) { if(num){ _num = num; @@ -103,9 +102,6 @@ class MVertex{ std::set<MVertex*, MVertexLessThanLexicographic>::iterator linearSearch(std::set<MVertex*, MVertexLessThanLexicographic> &pos); - // Get the data associated with this vertex - virtual void *getData(){ return 0 /* _data*/ ; } - // IO routines void writeMSH(FILE *fp, bool binary=false, double scalingFactor=1.0); void writeMSH(FILE *fp, double version, bool binary, int num, diff --git a/Post/PView.cpp b/Post/PView.cpp index 7d532fb60f70e1172827e1714ff4e5637ccfcacf..1f984158be59fb03ba54a9f78b414e3487815ce0 100644 --- a/Post/PView.cpp +++ b/Post/PView.cpp @@ -1,4 +1,4 @@ -// $Id: PView.cpp,v 1.15 2008-02-17 08:48:08 geuzaine Exp $ +// $Id: PView.cpp,v 1.16 2008-02-18 18:32:54 geuzaine Exp $ // // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle // @@ -26,6 +26,7 @@ #include <algorithm> #include "PView.h" #include "PViewDataList.h" +#include "PViewDataGModel.h" #include "VertexArray.h" #include "SmoothData.h" #include "Message.h" @@ -262,16 +263,16 @@ bool PView::readPOS(std::string filename, int fileIndex) index++; if(fileIndex < 0 || fileIndex == index){ - PView *p = new PView(false); - PViewDataList *d = dynamic_cast<PViewDataList*>(p->getData()); - if(!d || !d->read(fp, version, format, size)){ + PViewDataList *d = new PViewDataList(false); + if(!d->readPOS(fp, version, format, size)){ Msg(GERROR, "Could not read data in list format"); - delete p; + delete d; return false; } else{ d->setFileName(filename); d->setFileIndex(index); + new PView(d); } } @@ -293,8 +294,29 @@ bool PView::readPOS(std::string filename, int fileIndex) bool PView::readMSH(std::string filename, int fileIndex) { - Msg(INFO, "Reading post-pro data from msh file"); - return false; + FILE *fp = fopen(filename.c_str(), "rb"); + if(!fp){ + Msg(GERROR, "Unable to open file '%s'", filename.c_str()); + return false; + } + + Msg(INFO, "Reading post-processing data from MSH file..."); + + // FIXME: to be implemented! + int index = 0; + PViewDataGModel *d = new PViewDataGModel(); + if(!d->readMSH(fp)){ + Msg(GERROR, "Could not read data in msh file"); + delete d; + return false; + } + else{ + d->setFileName(filename); + d->setFileIndex(index); + new PView(d); + } + + return true; } bool PView::write(std::string filename, int format, bool append) diff --git a/Post/PViewDataGModel.cpp b/Post/PViewDataGModel.cpp index 983864ee5f6b3b2289a58096492cede81da0d30d..b26b69fef6452cfc054aebc99954c7c58f11a0bd 100644 --- a/Post/PViewDataGModel.cpp +++ b/Post/PViewDataGModel.cpp @@ -1,4 +1,4 @@ -// $Id: PViewDataGModel.cpp,v 1.9 2008-02-17 08:48:08 geuzaine Exp $ +// $Id: PViewDataGModel.cpp,v 1.10 2008-02-18 18:32:54 geuzaine Exp $ // // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle // @@ -24,6 +24,12 @@ #include "PViewDataGModel.h" +bool PViewDataGModel::readMSH(FILE *fp) +{ + Msg(INFO, "Filling PViewDataGModel..."); + return false; +} + bool PViewDataGModel::writePOS(std::string name, bool binary, bool parsed, bool append) { diff --git a/Post/PViewDataGModel.h b/Post/PViewDataGModel.h index 45a06b44de6ef745f2630d29e0d824f356edeb72..90f3ca3ba46bb1c9ad3e822083dcfefbbbe1c47f 100644 --- a/Post/PViewDataGModel.h +++ b/Post/PViewDataGModel.h @@ -46,6 +46,7 @@ class PViewDataGModel : public PViewData { int getNumEdges(int ele){ return 0; } // I/O routines + bool readMSH(FILE *fp); bool writePOS(std::string name, bool binary=false, bool parsed=true, bool append=false); bool writeSTL(std::string name); diff --git a/Post/PViewDataList.h b/Post/PViewDataList.h index 6c38499390b33f937b042a9194e303974cd59ca2..8675548a6d6b16f579334d626f22eeb890f4884c 100644 --- a/Post/PViewDataList.h +++ b/Post/PViewDataList.h @@ -106,7 +106,7 @@ class PViewDataList : public PViewData { void getRawData(int type, List_T **l, int **ne, int *nc, int *nn); // I/O routines - bool read(FILE *fp, double version, int format, int size); + bool readPOS(FILE *fp, double version, int format, int size); bool writePOS(std::string name, bool binary=false, bool parsed=true, bool append=false); bool writeSTL(std::string name); diff --git a/Post/PViewDataListIO.cpp b/Post/PViewDataListIO.cpp index 11371270574416e8992e3887535ecc00daaf3668..865328dfb7902af1f1ce5f182f08a0552eae841b 100644 --- a/Post/PViewDataListIO.cpp +++ b/Post/PViewDataListIO.cpp @@ -1,4 +1,4 @@ -// $Id: PViewDataListIO.cpp,v 1.7 2008-02-17 08:48:08 geuzaine Exp $ +// $Id: PViewDataListIO.cpp,v 1.8 2008-02-18 18:32:54 geuzaine Exp $ // // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle // @@ -31,7 +31,7 @@ extern Context_T CTX; -bool PViewDataList::read(FILE *fp, double version, int format, int size) +bool PViewDataList::readPOS(FILE *fp, double version, int format, int size) { char name[256]; int t2l, t3l;