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

more work for PViewDataGModel

parent 710e2704
No related branches found
No related tags found
No related merge requests found
......@@ -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,
......
// $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)
......
// $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)
{
......
......@@ -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);
......
......@@ -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);
......
// $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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment