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

pp

parent 0ae38cbb
No related branches found
No related tags found
No related merge requests found
// $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;
......
......@@ -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{
......
// $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,10 +409,8 @@ bool PViewDataGModel::writeMED(std::string fileName)
}
// compute profile
char *profileName;
std::vector<med_int> profile, indices, mult;
if(_type == NodeData){
profileName = (char*)"nodeProfile";
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);
......@@ -421,35 +420,9 @@ bool PViewDataGModel::writeMED(std::string fileName)
}
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());
}
}
}
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++)
......
// $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;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment