added: -last option to HDF5toVTx. dumps only the last time step
git-svn-id: http://svn.sintef.no/trondheim/IFEM/trunk@1062 e10b68d5-8a6e-419e-a041-bce267b0401d
This commit is contained in:
parent
92ac07a386
commit
3241f08a43
@ -142,6 +142,7 @@ int main (int argc, char** argv)
|
||||
int n[3] = { 5, 5, 5 };
|
||||
int dims = 3;
|
||||
int skip=1;
|
||||
bool last=false;
|
||||
char* infile = 0;
|
||||
char* vtffile = 0;
|
||||
char* basis = 0;
|
||||
@ -155,6 +156,8 @@ int main (int argc, char** argv)
|
||||
dims = 1;
|
||||
else if (!strcmp(argv[i],"-2D"))
|
||||
dims = 2;
|
||||
else if (!strcmp(argv[i],"-last"))
|
||||
last = true;
|
||||
else if (!strcmp(argv[i],"-ndump") && i < argc-1)
|
||||
skip = atoi(argv[++i]);
|
||||
else if (!strcmp(argv[i],"-basis") && i < argc-1)
|
||||
@ -169,7 +172,7 @@ int main (int argc, char** argv)
|
||||
if (!infile) {
|
||||
std::cout <<"usage: "<< argv[0]
|
||||
<<" <inputfile> [<vtffile>] [<vtufile>] [-nviz <nviz>] [-ndump <ndump>]"
|
||||
<<" [-basis <basis>] [-1D|-2D]"<< std::endl;
|
||||
<<" [-last] [-basis <basis>] [-1D|-2D]"<< std::endl;
|
||||
return 0;
|
||||
}
|
||||
else if (!vtffile)
|
||||
@ -199,7 +202,7 @@ int main (int argc, char** argv)
|
||||
if (strstr(vtffile,".vtf"))
|
||||
myVtf = new VTF(vtffile,1);
|
||||
else
|
||||
myVtf = new VTU(vtffile,1);
|
||||
myVtf = new VTU(vtffile,last?1:0);
|
||||
|
||||
for (it = entry.begin(); it != entry.end(); ++it) {
|
||||
if (!it->basis.empty() && it->type != "restart") {
|
||||
@ -228,7 +231,7 @@ int main (int argc, char** argv)
|
||||
int block = 0;
|
||||
double time=0;
|
||||
int k=1;
|
||||
for (int i = 0; i <= levels && ok; i += skip) {
|
||||
for (int i = last?levels:0; i <= levels && ok; i += skip) {
|
||||
if (levels > 0) std::cout <<"\nTime level "<< i << " (t=" << time << ")" << std::endl;
|
||||
VTFList vlist, slist;
|
||||
for (pit = processlist.begin(); pit != processlist.end(); ++pit) {
|
||||
|
@ -20,8 +20,8 @@
|
||||
#include <sstream>
|
||||
|
||||
|
||||
VTU::VTU(const char* base, int format)
|
||||
: VTF(NULL,format), m_base(base)
|
||||
VTU::VTU(const char* base, bool single)
|
||||
: VTF(NULL,0), m_base(base), m_single(single)
|
||||
{
|
||||
m_base = m_base.substr(0,m_base.rfind('.'));
|
||||
}
|
||||
@ -83,7 +83,10 @@ bool VTU::writeState(int iStep, const char* fmt, real refValue, int refType)
|
||||
{
|
||||
std::ofstream file;
|
||||
std::stringstream str;
|
||||
str << m_base << "-" << std::setfill('0') << std::setw(5) << iStep-1 << ".vtu";
|
||||
str << m_base;
|
||||
if (!m_single)
|
||||
str << "-" << std::setfill('0') << std::setw(5) << iStep-1;
|
||||
str << ".vtu";
|
||||
file.open(str.str().c_str());
|
||||
|
||||
file << "<?xml version=\"1.0\"?>" << std::endl;
|
||||
|
@ -24,7 +24,7 @@ class ElementBlock;
|
||||
|
||||
class VTU : public VTF {
|
||||
public:
|
||||
VTU(const char* base, int format);
|
||||
VTU(const char* base, bool single);
|
||||
virtual ~VTU();
|
||||
|
||||
bool writeGrid(const ElementBlock* lvb, const char* name);
|
||||
@ -50,4 +50,5 @@ class VTU : public VTF {
|
||||
std::string name;
|
||||
};
|
||||
std::map<int,FieldInfo> m_field;
|
||||
bool m_single;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user