diff --git a/Geo/GModelIO_MED.cpp b/Geo/GModelIO_MED.cpp index 32fd8fc89e473a17407165bc89f9791f74e6550c..120139515a62d9f3f43a3550101ab87d037e1433 100644 --- a/Geo/GModelIO_MED.cpp +++ b/Geo/GModelIO_MED.cpp @@ -1,4 +1,4 @@ -// $Id: GModelIO_MED.cpp,v 1.24 2008-04-02 18:57:57 geuzaine Exp $ +// $Id: GModelIO_MED.cpp,v 1.25 2008-04-02 20:00:38 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -37,7 +37,7 @@ extern "C" { #include <med.h> } -static med_geometrie_element msh2medElementType(int msh) +med_geometrie_element msh2medElementType(int msh) { switch(msh) { case MSH_LIN_2: return MED_SEG2; diff --git a/Post/PViewData.h b/Post/PViewData.h index 15f9448135c91eb22b52483bd91c4e2cc6c63fd9..982802bd8cbb307999d279f87acf39fcbbbf44a8 100644 --- a/Post/PViewData.h +++ b/Post/PViewData.h @@ -118,9 +118,9 @@ class PViewData { virtual bool writeSTL(std::string fileName); virtual bool writeTXT(std::string fileName); virtual bool writePOS(std::string fileName, bool binary=false, bool parsed=true, - bool append=false){ return false; } - virtual bool writeMSH(std::string fileName, bool binary=false){ return false; } - virtual bool writeMED(std::string fileName){ return false; } + bool append=false); + virtual bool writeMSH(std::string fileName, bool binary=false); + virtual bool writeMED(std::string fileName); }; class nameData{ diff --git a/Post/PViewDataGModelIO.cpp b/Post/PViewDataGModelIO.cpp index 47ea33603a4c239c1836f2a8657eee29f2502c5e..a74fdf24b7a30c80ec2767ab6a9c464b20fef8ea 100644 --- a/Post/PViewDataGModelIO.cpp +++ b/Post/PViewDataGModelIO.cpp @@ -1,4 +1,4 @@ -// $Id: PViewDataGModelIO.cpp,v 1.35 2008-04-02 18:57:57 geuzaine Exp $ +// $Id: PViewDataGModelIO.cpp,v 1.36 2008-04-02 20:00:38 geuzaine Exp $ // // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle // @@ -147,6 +147,7 @@ extern "C" { #include <med.h> } +extern med_geometrie_element msh2medElementType(int msh); extern int med2mshElementType(med_geometrie_element med); extern int med2mshNodeIndex(med_geometrie_element med, int k); @@ -408,48 +409,20 @@ bool PViewDataGModel::writeMED(std::string fileName) } // compute profile - char *profileName; - std::vector<med_int> profile, indices, mult; - if(_type == NodeData){ - profileName = (char*)"nodeProfile"; - for(int i = 0; i < _steps[0]->getNumData(); i++){ - if(_steps[0]->getData(i)){ - MVertex *v = _steps[0]->getModel()->getMeshVertexByTag(i); - if(!v){ - Msg(GERROR, "Unknown vertex %d in data", i); - return false; - } - profile.push_back(v->getIndex()); - indices.push_back(i); - mult.push_back(1); - } - } - } - else{ - // FIXME: not tested - profileName = (char*)"elementProfile"; - std::vector<MElement*> elements; - int offset = model->getNumVertices(); - for(int i = 0; i < _steps[0]->getNumEntities(); i++) - for(int j = 0; j < _steps[0]->getEntity(i)->getNumMeshElements(); j++) - elements.push_back(_steps[0]->getEntity(i)->getMeshElement(j)); - for(int i = 0; i < _steps[0]->getNumData(); i++){ - if(_steps[0]->getData(i)){ - int idx = i - offset; - if(idx < 0 || idx >= elements.size()){ - Msg(GERROR, "Unknown element %d in data", idx); - return false; - } - MElement *e = elements[idx]; - profile.push_back(idx); - indices.push_back(i); - if(_type == GaussPointData) - mult.push_back(_steps[0]->getGaussPoints(e->getTypeForMSH()).size() / 3); - else - mult.push_back(e->getNumVertices()); + char *profileName = (char*)"nodeProfile"; + std::vector<med_int> profile, indices; + for(int i = 0; i < _steps[0]->getNumData(); i++){ + if(_steps[0]->getData(i)){ + MVertex *v = _steps[0]->getModel()->getMeshVertexByTag(i); + if(!v){ + Msg(GERROR, "Unknown vertex %d in data", i); + return false; } + profile.push_back(v->getIndex()); + indices.push_back(i); } } + if(profile.empty()){ Msg(GERROR, "Nothing to save"); return false; @@ -467,14 +440,12 @@ bool PViewDataGModel::writeMED(std::string fileName) return false; } - // FIXME: generalize following for all _types med_int numNodes = MEDnEntMaa(fid, meshName, MED_COOR, MED_NOEUD, MED_NONE, (med_connectivite)0); if(numNodes <= 0){ Msg(GERROR, "Could not get valid number of nodes in mesh"); return false; } - for(unsigned int step = 0; step < _steps.size(); step++){ unsigned int n = 0; for(int i = 0; i < _steps[step]->getNumData(); i++) diff --git a/Post/PViewDataIO.cpp b/Post/PViewDataIO.cpp index 5cd5b9a347415b5812e60e8a2ddcdaed82b4c082..d29ce6d6fa7f6191184558632b9db4b5c61e0fc2 100644 --- a/Post/PViewDataIO.cpp +++ b/Post/PViewDataIO.cpp @@ -1,4 +1,4 @@ -// $Id: PViewDataIO.cpp,v 1.7 2008-03-29 10:19:43 geuzaine Exp $ +// $Id: PViewDataIO.cpp,v 1.8 2008-04-02 20:00:38 geuzaine Exp $ // // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle // @@ -116,3 +116,21 @@ bool PViewData::writeTXT(std::string fileName) fclose(fp); return true; } + +bool PViewData::writePOS(std::string fileName, bool binary, bool parsed, bool append) +{ + Msg(GERROR, "POS export not implemented for this view type"); + return false; +} + +bool PViewData::writeMSH(std::string fileName, bool binary) +{ + Msg(GERROR, "MSH export not implemented for this view type"); + return false; +} + +bool PViewData::writeMED(std::string fileName) +{ + Msg(GERROR, "MED export not implemented for this view type"); + return false; +}