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

bug fixes

parent da5ff60b
No related branches found
No related tags found
No related merge requests found
// $Id: PViewDataGModel.cpp,v 1.43 2008-03-31 16:04:42 geuzaine Exp $
// $Id: PViewDataGModel.cpp,v 1.44 2008-03-31 21:12:41 geuzaine Exp $
//
// Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
//
......@@ -140,28 +140,32 @@ int PViewDataGModel::getDimension(int step, int ent, int ele)
int PViewDataGModel::getNumNodes(int step, int ent, int ele)
{
// no sanity checks (assumed to be guarded by skipElement)
if(_type == GaussPointData) return 1; // FIXME!
if(_type == GaussPointData){
return 1; // FIXME
}
else{
return _steps[step]->getEntity(ent)->getMeshElement(ele)->getNumVertices();
//return _steps[step]->getEntity(ent)->getMeshElement(ele)->getNumPrimaryVertices();
}
}
void PViewDataGModel::getNode(int step, int ent, int ele, int nod,
double &x, double &y, double &z)
{
if(_type == GaussPointData){ // FIXME!
// no sanity checks (assumed to be guarded by skipElement)
if(_type == GaussPointData){
// FIXME
MElement *e = _steps[step]->getEntity(ent)->getMeshElement(ele);
SPoint3 bc = e->barycenter();
x = bc.x(); y = bc.y(); z = bc.z();
return;
}
// no sanity checks (assumed to be guarded by skipElement)
else{
MVertex *v = _steps[step]->getEntity(ent)->getMeshElement(ele)->getVertex(nod);
x = v->x();
y = v->y();
z = v->z();
}
}
int PViewDataGModel::getNumComponents(int step, int ent, int ele)
{
......
// $Id: PViewDataGModelIO.cpp,v 1.29 2008-03-31 16:04:42 geuzaine Exp $
// $Id: PViewDataGModelIO.cpp,v 1.30 2008-03-31 21:12:41 geuzaine Exp $
//
// Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
//
......@@ -175,6 +175,8 @@ bool PViewDataGModel::readMED(std::string fileName, int fileIndex)
Msg(INFO, "Reading %d-component field <<%s>>", numComp, name);
setName(name);
int numCompMsh = (numComp == 1) ? 1 : (numComp < 3) ? 3 : 9;
// the ordering of the elements in the following lists is important:
// it should match the ordering of the MSH element types (when
// elements are saved without tags, this governs the order with
......@@ -236,7 +238,6 @@ bool PViewDataGModel::readMED(std::string fileName, int fileIndex)
Msg(GERROR, "Could not find mesh <<%s>>", meshName);
return false;
}
int numCompMsh = (numComp == 1) ? 1 : (numComp < 3) ? 3 : 9;
while(step >= (int)_steps.size())
_steps.push_back(new stepData<double>(m, numCompMsh));
_steps[step]->setFileName(fileName);
......@@ -254,7 +255,7 @@ bool PViewDataGModel::readMED(std::string fileName, int fileIndex)
if(ent == MED_NOEUD_ELEMENT){
mult = nodesPerEle[pairs[pair].second];
}
else if(ngauss > 1){
else if(ngauss != MED_NOPG){
mult = ngauss;
setType(GaussPointData);
}
......@@ -272,6 +273,21 @@ bool PViewDataGModel::readMED(std::string fileName, int fileIndex)
return false;
}
// read Gauss point data
if(ngauss != MED_NOPG){
std::vector<med_float> refcoo((ele % 100) * (ele / 100));
std::vector<med_float> gscoo(ngauss * ele / 100);
std::vector<med_float> wg(ngauss);
if(MEDgaussLire(fid, &refcoo[0], &gscoo[0], &wg[0], MED_FULL_INTERLACE,
locname) < 0){
Msg(GERROR, "Could not read Gauss points");
return false;
}
// FIXME: store this in stepData, e.g. in a vector indexed by
// mshEleType std::vector<std::vector<u,v,w, u,v,w, u,v,w, ...> >
// (ele/100==geo dim, ele%100==num nodes)
}
// compute profile (indices in full array of entities of given type)
std::vector<med_int> profile;
if(std::string(profileName) != MED_NOPFL){
......@@ -331,8 +347,8 @@ bool PViewDataGModel::readMED(std::string fileName, int fileIndex)
// reorder nodes if we have ElementNode data
int j2 = (ent == MED_NOEUD_ELEMENT) ? med2msh(ele, j) : j;
for(int k = 0; k < numComp; k++)
d[numComp * j + k] = val[numComp * mult * i + numComp * j2 + k];
double s = ComputeScalarRep(_steps[step]->getNumComponents(), &d[numComp * j]);
d[numCompMsh * j + k] = val[numComp * mult * i + numComp * j2 + k];
double s = ComputeScalarRep(numCompMsh, &d[numCompMsh * j]);
_steps[step]->setMin(std::min(_steps[step]->getMin(), s));
_steps[step]->setMax(std::max(_steps[step]->getMax(), s));
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment