added: knot-span wise output to VTU
git-svn-id: http://svn.sintef.no/trondheim/IFEM/trunk@1158 e10b68d5-8a6e-419e-a041-bce267b0401d
This commit is contained in:
parent
0a2afc212e
commit
96e292493f
@ -48,6 +48,7 @@ bool VTU::writeVres(const std::vector<real>& field, int blockID, int geomID,
|
||||
m_field[blockID].data = new Vector(field.data(),field.size());
|
||||
m_field[blockID].components = components;
|
||||
m_field[blockID].patch = geomID;
|
||||
m_field[blockID].cellData = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -57,6 +58,16 @@ bool VTU::writeNres(const std::vector<real>& field, int blockID, int geomID)
|
||||
m_field[blockID].data = new Vector(field.data(),field.size());
|
||||
m_field[blockID].components = 1;
|
||||
m_field[blockID].patch = geomID;
|
||||
m_field[blockID].cellData = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool VTU::writeEres(const std::vector<real>& field, int blockID, int geomID)
|
||||
{
|
||||
m_field[blockID].data = new Vector(field.data(),field.size());
|
||||
m_field[blockID].components = 1;
|
||||
m_field[blockID].patch = geomID;
|
||||
m_field[blockID].cellData = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -146,6 +157,8 @@ bool VTU::writeState(int iStep, const char* fmt, real refValue, int refType)
|
||||
file << "\t\t\t<PointData Scalars=\"scalars\">" << std::endl;
|
||||
for (std::map<int,FieldInfo>::iterator it2 = m_field.begin();
|
||||
it2 != m_field.end();++it2) {
|
||||
if (it2->second.cellData)
|
||||
continue;
|
||||
if (it2->second.patch == (int)i+1) {
|
||||
file << "\t\t\t\t<DataArray type=\"Float32\" Name=\"" << it2->second.name << "\""
|
||||
<< " NumberOfComponents=\"" << it2->second.components
|
||||
@ -158,6 +171,24 @@ bool VTU::writeState(int iStep, const char* fmt, real refValue, int refType)
|
||||
}
|
||||
}
|
||||
file << "\t\t\t</PointData>" << std::endl;
|
||||
// now add cell datas
|
||||
file << "\t\t\t<CellData Scalars=\"scalars\">" << std::endl;
|
||||
for (std::map<int,FieldInfo>::iterator it2 = m_field.begin();
|
||||
it2 != m_field.end();++it2) {
|
||||
if (!it2->second.cellData)
|
||||
continue;
|
||||
if (it2->second.patch == (int)i+1) {
|
||||
file << "\t\t\t\t<DataArray type=\"Float32\" Name=\"" << it2->second.name << "\""
|
||||
<< " NumberOfComponents=\"" << it2->second.components
|
||||
<< "\" format=\"ascii\">" << std::endl;
|
||||
file << "\t\t\t\t\t";
|
||||
for (size_t k=0;k<it2->second.data->size();++k)
|
||||
file << (*it2->second.data)[k] << " ";
|
||||
delete it2->second.data;
|
||||
file << std::endl << "\t\t\t\t</DataArray>" << std::endl;
|
||||
}
|
||||
}
|
||||
file << "\t\t\t</CellData>" << std::endl;
|
||||
file << "\t\t</Piece>" << std::endl;
|
||||
}
|
||||
file << "\t</UnstructuredGrid>" << std::endl;
|
||||
|
@ -32,6 +32,7 @@ class VTU : public VTF {
|
||||
bool writeVres(const std::vector<double>& field, int blockID,
|
||||
int geomID, int components);
|
||||
bool writeNres(const std::vector<double>& vec, int blockID, int geomID);
|
||||
bool writeEres(const std::vector<double>& vec, int blockID, int geomID);
|
||||
|
||||
bool writeVblk(const std::vector<int>& vBlockIDs,
|
||||
const char* resultName, int idBlock, int iStep=1);
|
||||
@ -41,6 +42,8 @@ class VTU : public VTF {
|
||||
const char* resultName, int idBlock, int iStep=1);
|
||||
|
||||
bool writeState(int iStep, const char* fmt, real refValue, int refType=0);
|
||||
|
||||
const ElementBlock* getBlock(int geomID) const { return m_geom[geomID-1]; }
|
||||
protected:
|
||||
std::string m_base;
|
||||
std::vector<const ElementBlock*> m_geom;
|
||||
@ -48,6 +51,7 @@ class VTU : public VTF {
|
||||
Vector* data;
|
||||
int components;
|
||||
int patch;
|
||||
bool cellData;
|
||||
std::string name;
|
||||
};
|
||||
std::map<int,FieldInfo> m_field;
|
||||
|
@ -70,8 +70,8 @@ public:
|
||||
//! length must equal the number of elements in the geometry block
|
||||
//! \param[in] idBlock Result block identifier
|
||||
//! \param[in] gID Geometry block identifier
|
||||
bool writeEres(const std::vector<real>& elmResult,
|
||||
int idBlock = 1, int gID = 1);
|
||||
virtual bool writeEres(const std::vector<real>& elmResult,
|
||||
int idBlock = 1, int gID = 1);
|
||||
//! \brief Writes a block of vector nodal results to the VTF-file.
|
||||
//! \param[in] nodeResult Vector of nodal results, length must be equal the
|
||||
//! number of nodes in the geometry block times 1...5
|
||||
@ -136,7 +136,7 @@ public:
|
||||
real refValue, int refType = 0);
|
||||
|
||||
//! \brief Returns the pointer to a geometry block.
|
||||
const ElementBlock* getBlock(int geomID) const { return myBlocks[geomID-1]; }
|
||||
virtual const ElementBlock* getBlock(int geomID) const { return myBlocks[geomID-1]; }
|
||||
|
||||
private:
|
||||
//! \brief Writes a geometry block to the VTF-file.
|
||||
|
Loading…
Reference in New Issue
Block a user