From 3e9662bfaeed47616e14d407f171e084c6867f50 Mon Sep 17 00:00:00 2001 From: akva Date: Wed, 1 Jun 2011 13:36:32 +0000 Subject: [PATCH] added: flag the primary solution vector with type="restart" this allows ignoring it during the conversion to VTF. i used type "restart" since this vector will only be of interest when doing restarted runs git-svn-id: http://svn.sintef.no/trondheim/IFEM/trunk@1026 e10b68d5-8a6e-419e-a041-bce267b0401d --- src/Utility/XMLWriter.C | 18 ++++++++++-------- src/Utility/XMLWriter.h | 4 +++- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/Utility/XMLWriter.C b/src/Utility/XMLWriter.C index 374b364c..ec485d5a 100644 --- a/src/Utility/XMLWriter.C +++ b/src/Utility/XMLWriter.C @@ -73,6 +73,7 @@ void XMLWriter::readInfo() entry.description = elem->Attribute("description"); entry.patches = atoi(elem->Attribute("patches")); entry.components = atoi(elem->Attribute("components")); + entry.type = elem->Attribute("type"); if (elem->Attribute("basis")) entry.basis = elem->Attribute("basis"); m_entry.push_back(entry); @@ -118,39 +119,40 @@ void XMLWriter::writeSIM (int level, const DataEntry& entry) if (prob->mixedFormulation()) { // primary solution vector - addField(entry.first,entry.second.description,sim->getName()+"-0", - prob->getNoFields(1),sim->getNoPatches()); + addField(entry.first,entry.second.description,sim->getName()+"-1", + prob->getNoFields(1),sim->getNoPatches(),"restart"); // Assuming that basis2 is used for secondary variables // primary solution fields - addField(prob->getField1Name(11),"primary",sim->getName()+"-0", + addField(prob->getField1Name(11),"primary",sim->getName()+"-1", sim->getNoFields(1),sim->getNoPatches()); - addField(prob->getField1Name(12),"primary",sim->getName()+"-1", + addField(prob->getField1Name(12),"primary",sim->getName()+"-2", sim->getNoFields(2),sim->getNoPatches()); } else { // primary solution - addField(prob->getField1Name(11),entry.second.description,sim->getName()+"-0", + addField(prob->getField1Name(11),entry.second.description,sim->getName()+"-1", prob->getNoFields(1),sim->getNoPatches()); } // secondary solution fields if (entry.second.size == -1) for (size_t j = 0; j < prob->getNoFields(2); j++) - addField(prob->getField2Name(j),"secondary",sim->getName()+"-1",1,sim->getNoPatches()); + addField(prob->getField2Name(j),"secondary",sim->getName()+(prob->mixedFormulation()?"-2":"-1"),1,sim->getNoPatches()); } void XMLWriter::addField (const std::string& name, const std::string& description, const std::string& basis, - int components, int patches) + int components, int patches, + const std::string& type) { TiXmlElement element("entry"); element.SetAttribute("name",name.c_str()); element.SetAttribute("description",description.c_str()); - element.SetAttribute("type","field"); + element.SetAttribute("type",type); if (!basis.empty()) element.SetAttribute("basis",basis.c_str()); element.SetAttribute("patches",patches); diff --git a/src/Utility/XMLWriter.h b/src/Utility/XMLWriter.h index 79465619..fb45a207 100644 --- a/src/Utility/XMLWriter.h +++ b/src/Utility/XMLWriter.h @@ -17,6 +17,7 @@ public: std::string basis; int patches; int components; + std::string type; }; XMLWriter(const std::string& name); @@ -37,7 +38,8 @@ public: protected: void addField(const std::string& name, const std::string& description, - const std::string& geometry, int components, int patches); + const std::string& geometry, int components, int patches, + const std::string& type="field"); std::vector m_entry;