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

move iso compututation routines to Numeric module

parent c7d65522
No related branches found
No related tags found
No related merge requests found
......@@ -411,7 +411,6 @@ void MElement::writeMSH(FILE *fp, double version, bool binary, int num,
for(int i = 0; i < n; i++)
verts[i] = getVertex(i)->getIndex();
if(!binary){
for(int i = 0; i < n; i++)
fprintf(fp, " %d", verts[i]);
......
......@@ -5,7 +5,6 @@
set(SRC
Trackball.cpp
Iso.cpp
ReadImg.cpp
drawContext.cpp
drawMesh.cpp
......
......@@ -23,6 +23,7 @@ set(SRC
GaussLegendreSimplex.cpp
GmshPredicates.cpp
mathEvaluator.cpp
Iso.cpp
)
append_gmsh_src(Numeric "${SRC}")
File moved
File moved
......@@ -112,14 +112,8 @@ bool PViewDataGModel::writeMSH(std::string fileName, bool binary)
return false;
}
// if(_type != NodeData){
// Msg::Error("Can only export node-based datasets for now");
// return false;
// }
GModel *model = _steps[0]->getModel();
//binary = true;
if(!model->writeMSH(fileName, 2.0, binary, true)) return false;
// append data
......@@ -130,15 +124,15 @@ bool PViewDataGModel::writeMSH(std::string fileName, bool binary)
}
for(unsigned int step = 0; step < _steps.size(); step++){
int numNodes = 0, numComp = _steps[step]->getNumComponents();
int numEnt = 0, numComp = _steps[step]->getNumComponents();
for(int i = 0; i < _steps[step]->getNumData(); i++)
if(_steps[step]->getData(i)) numNodes++;
if(numNodes){
if (_type == NodeData){
if(_steps[step]->getData(i)) numEnt++;
if(numEnt){
if(_type == NodeData){
fprintf(fp, "$NodeData\n");
fprintf(fp, "1\n\"%s\"\n", getName().c_str());
fprintf(fp, "1\n%.16g\n", _steps[step]->getTime());
fprintf(fp, "3\n%d\n%d\n%d\n", step, numComp, numNodes);
fprintf(fp, "3\n%d\n%d\n%d\n", step, numComp, numEnt);
for(int i = 0; i < _steps[step]->getNumData(); i++){
if(_steps[step]->getData(i)){
MVertex *v = _steps[step]->getModel()->getMeshVertexByTag(i);
......@@ -163,18 +157,31 @@ bool PViewDataGModel::writeMSH(std::string fileName, bool binary)
fprintf(fp, "$EndNodeData\n");
}
else{
fprintf(fp, "$ElementData\n");
int mult = 1;
if(_type == ElementNodeData){
fprintf(fp, "$ElementNodeData\n");
mult = 1; // FIXME
}
else
fprintf(fp, "$ElementData\n");
fprintf(fp, "1\n\"%s\"\n", getName().c_str());
fprintf(fp, "1\n%.16g\n", _steps[step]->getTime());
fprintf(fp, "3\n%d\n%d\n%d\n", step, numComp, numNodes);
fprintf(fp, "3\n%d\n%d\n%d\n", step, numComp, numEnt);
for(int i = 0; i < _steps[step]->getNumData(); i++){
if(_steps[step]->getData(i)){
// FIXME
// MElement *e = model->getMeshElementByTag(i);
// if(!e){
//
// }
// int num = e->getNum();
int num = i;
if(binary){
fwrite(&i, sizeof(int), 1, fp);
fwrite(&num, sizeof(int), 1, fp);
fwrite(_steps[step]->getData(i), sizeof(double), numComp, fp);
}
else{
fprintf(fp, "%d", i);
fprintf(fp, "%d", num);
for(int k = 0; k < numComp; k++)
fprintf(fp, " %.16g", _steps[step]->getData(i)[k]);
fprintf(fp, "\n");
......@@ -182,7 +189,10 @@ bool PViewDataGModel::writeMSH(std::string fileName, bool binary)
}
}
if(binary) fprintf(fp, "\n");
fprintf(fp, "$EndElementData\n");
if(_type == ElementNodeData)
fprintf(fp, "$EndElementNodeData\n");
else
fprintf(fp, "$EndElementData\n");
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment