Thread: [Echempp-devel] GUI/Windows/Qt/EChem++/Model Makefile.am, 1.43, 1.44 batchExperimentDialog.cpp, 1.1
Status: Beta
Brought to you by:
berndspeiser
Update of /cvsroot/echempp/GUI/Windows/Qt/EChem++/Model In directory sc8-pr-cvs17.sourceforge.net:/tmp/cvs-serv26240/GUI/Windows/Qt/EChem++/Model Modified Files: Makefile.am batchExperimentDialog.cpp equilibriumDialog.cpp equilibriumDialog.hpp experimentDialog.cpp experimentDialog.hpp mechanismDialog.cpp mechanismDialog.hpp mediator.cpp mediator.hpp modelMainWindow.cpp modelMainWindow.hpp modelParametersDialog.cpp modelParametersDialog.hpp modelPlotWidget.cpp modelPlotWidget.hpp scalingDialog.cpp scalingDialog.hpp solverDialog.cpp solverDialog.hpp svmDataDialog.cpp Log Message: Removed obsolete serialization code and old supply() functions. There should be no more ref. to TinyXML any more. Index: modelPlotWidget.hpp =================================================================== RCS file: /cvsroot/echempp/GUI/Windows/Qt/EChem++/Model/modelPlotWidget.hpp,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** modelPlotWidget.hpp 3 Mar 2007 19:34:59 -0000 1.36 --- modelPlotWidget.hpp 22 Dec 2007 15:53:16 -0000 1.37 *************** *** 249,253 **** const std::string& type ); ! void saveActiveData( BSUtilities::xmlw::XmlStream& xml ); void removePlot( uint_t pos ); --- 249,253 ---- const std::string& type ); ! void saveActiveData( const QString& fileName ); void removePlot( uint_t pos ); Index: equilibriumDialog.hpp =================================================================== RCS file: /cvsroot/echempp/GUI/Windows/Qt/EChem++/Model/equilibriumDialog.hpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** equilibriumDialog.hpp 19 Dec 2007 11:52:45 -0000 1.20 --- equilibriumDialog.hpp 22 Dec 2007 15:53:16 -0000 1.21 *************** *** 36,41 **** #include "Model/guiTypes.hpp" - #include "xmlwriter.h" - #include <qprogressdialog.h> #include <qlineedit.h> --- 36,39 ---- *************** *** 63,68 **** void supply(); - void supply( const QDomElement& dialog ); - void save( BSUtilities::xmlw::XmlStream& xml ); void setReactionNetwork( ecco::ReactionNetwork* const net ); --- 61,64 ---- Index: scalingDialog.hpp =================================================================== RCS file: /cvsroot/echempp/GUI/Windows/Qt/EChem++/Model/scalingDialog.hpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** scalingDialog.hpp 25 Mar 2006 10:40:32 -0000 1.14 --- scalingDialog.hpp 22 Dec 2007 15:53:16 -0000 1.15 *************** *** 37,43 **** #include "Ecco/reactionNetwork.hpp" - #include "xmlwriter.h" - #include <qdom.h> - #include <vector> --- 37,40 ---- *************** *** 55,64 **** ~ScalingDialog(); - //! - void supply( const QDomElement& dialog ); - - //! - void save( BSUtilities::xmlw::XmlStream& xml); - //! use "PC" for potential controlled or "CC" fo current controlled void setTechnique( const std::string& tech ); --- 52,55 ---- *************** *** 89,95 **** private: - //! - void setConcentrationTolerances( const QDomElement& root ); - //! index = row index QMemArray<int> _concRows; --- 80,83 ---- Index: mediator.hpp =================================================================== RCS file: /cvsroot/echempp/GUI/Windows/Qt/EChem++/Model/mediator.hpp,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** mediator.hpp 19 Dec 2007 11:52:48 -0000 1.41 --- mediator.hpp 22 Dec 2007 15:53:16 -0000 1.42 *************** *** 86,92 **** void supply(); - void readProjectFile( const QString& fileName ); - void writeProjectFile( const QString& fileName ); - void writeDataFile( const QString& fileName ); --- 86,89 ---- Index: Makefile.am =================================================================== RCS file: /cvsroot/echempp/GUI/Windows/Qt/EChem++/Model/Makefile.am,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** Makefile.am 19 Dec 2007 11:51:20 -0000 1.43 --- Makefile.am 22 Dec 2007 15:53:16 -0000 1.44 *************** *** 289,293 **** # in a similar way, -Werror should later be re-introduced here; it has to be deleted because # of `deprecated' warnings generated by vtk 5.0 ! ModSim_CXXFLAGS = -DTIXML_USE_STL $(CXXFLAGS) $(QT_CXXFLAGS) -Wall -pedantic-errors\ -Wno-non-virtual-dtor -Wno-deprecated -Wno-long-long -Wno-strict-aliasing --- 289,293 ---- # in a similar way, -Werror should later be re-introduced here; it has to be deleted because # of `deprecated' warnings generated by vtk 5.0 ! ModSim_CXXFLAGS = $(CXXFLAGS) $(QT_CXXFLAGS) -Wall -pedantic-errors\ -Wno-non-virtual-dtor -Wno-deprecated -Wno-long-long -Wno-strict-aliasing Index: scalingDialog.cpp =================================================================== RCS file: /cvsroot/echempp/GUI/Windows/Qt/EChem++/Model/scalingDialog.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** scalingDialog.cpp 26 Mar 2007 17:05:32 -0000 1.17 --- scalingDialog.cpp 22 Dec 2007 15:53:16 -0000 1.18 *************** *** 231,427 **** } - void - ScalingDialog::save( BSUtilities::xmlw::XmlStream& xml ) - { - // <scaling_dialog> - // <concentration rows="3"> - // <cd> - // <name>A</name> - // <ATOL>1.0</ATOL> - // <RTOL>1.0</RTOL> - // </cd> - // <cd> - // <name>B</name> - // <ATOL>1.0</ATOL> - // <RTOL>1.0</RTOL> - // </cd> - // <cd> - // <name>C</name> - // <ATOL>1.0</ATOL> - // <RTOL>1.0</RTOL> - // </cd> - // </concentration> - // <response type="Current" ATOL="..." RTOL="..."> - // </response> - // </scaling_dialog> - - xml << BSUtilities::xmlw::tag("scaling_dialog") - - << BSUtilities::xmlw::tag("concentration") - << BSUtilities::xmlw::attr("rows") << _concTable->numRows(); - - int i=0; - while( i < _concTable->numRows() ) - { - xml << BSUtilities::xmlw::tag("cd") - - << BSUtilities::xmlw::tag("name") - << BSUtilities::xmlw::chardata() << _concTable->verticalHeader()->label(i).ascii() - << BSUtilities::xmlw::endtag("name") - - << BSUtilities::xmlw::tag("ATOL") - << BSUtilities::xmlw::chardata() << _concTable->text(i,0).ascii() - << BSUtilities::xmlw::endtag("ATOL") - - << BSUtilities::xmlw::tag("RTOL") - << BSUtilities::xmlw::chardata() << _concTable->text(i,1).ascii() - << BSUtilities::xmlw::endtag("RTOL") - - << BSUtilities::xmlw::endtag("cd"); - - ++i; - } - xml << BSUtilities::xmlw::endtag("concentration"); - - xml << BSUtilities::xmlw::tag("response") - << BSUtilities::xmlw::attr("type") << _responseGroup->title().ascii() - << BSUtilities::xmlw::attr("ATOL") << _resATOLEdit->text().ascii() - << BSUtilities::xmlw::attr("RTOL") << _resRTOLEdit->text().ascii() - - << BSUtilities::xmlw::endtag("response"); - - xml << BSUtilities::xmlw::endtag("scaling_dialog"); - - } - - void - ScalingDialog::supply( const QDomElement& dialog ) - { - if( !(dialog.nodeName() == "scaling_dialog") ) - { - QMessageBox::critical( 0, - QObject::tr( "Critical Error" ), - QObject::tr( "No scaling_dialog node given to ScalingDialog::supply()" ) ); - return; - } - - QDomNode node = dialog.firstChild(); - while( !node.isNull() ) - { - if( node.isElement() & (node.nodeName() == "concentration") ) - { - QDomElement conc = node.toElement(); - QString rows = conc.attribute("rows"); - int N = rows.toInt(); - - _concTable->removeRows( _concRows ); - _concRows.resize(N); - _rowCounter = 0; - this->setConcentrationTolerances( conc ); - } - else if( node.isElement() & (node.nodeName() == "response") ) - { - QDomElement resp = node.toElement(); - - QString type = resp.attribute("type"); - QString ATOL = resp.attribute("ATOL"); - QString RTOL = resp.attribute("RTOL"); - - _responseGroup->setTitle( type ); - _resATOLEdit->setText( ATOL ); - _resRTOLEdit->setText( RTOL ); - - bool ok = false; - double value = _resATOLEdit->text().toDouble(&ok); - if( ok ) - { - _resATOL = value; - } - else - { - QMessageBox::critical( 0, "Critical Error", - "XML error in ScalingDialog::supply()!", - QMessageBox::Ok, - QMessageBox::NoButton, - QMessageBox::NoButton ); - } - - ok = false; - value = _resRTOLEdit->text().toDouble(&ok); - if( ok ) - { - _resRTOL = value; - } - else - { - QMessageBox::critical( 0, "Critical Error", - "XML error in ScalingDialog::supply()!", - QMessageBox::Ok, - QMessageBox::NoButton, - QMessageBox::NoButton ); - } - - - } - - node = node.nextSibling(); - } - } - - void - ScalingDialog::setConcentrationTolerances( const QDomElement& root ) - { - QDomNode node = root.firstChild(); - while( !node.isNull() ) - { - if( node.nodeName() == "cd" ) - { - // get name - QDomNodeList childs = node.childNodes(); - uint i = 0; - for(;i<childs.length();++i) - { - QDomNode entry = childs.item(i); - if( entry.isElement() & (entry.nodeName() == "name") ) - { - QDomElement name = entry.toElement(); - QString text = name.text(); - if( text.find("\n") != -1 ) - { - text.remove("\n"); - } - _concTable->insertRows(_rowCounter,1); - _concTable->verticalHeader()->setLabel(_rowCounter,text); - } - else if( entry.isElement() & (entry.nodeName() == "ATOL") ) - { - QDomElement ATOL = entry.toElement(); - QString text = ATOL.text(); - if( text.find("\n") != -1 ) - { - text.remove("\n"); - } - _concTable->setText(_rowCounter,0,text); - } - else if( entry.isElement() & (entry.nodeName() == "RTOL") ) - { - QDomElement RTOL = entry.toElement(); - QString text = RTOL.text(); - if( text.find("\n") != -1 ) - { - text.remove("\n"); - } - _concTable->setText(_rowCounter,1,text); - } - - } - ++_rowCounter; - } - node = node.nextSibling(); - } - } - - - } // namespace Model } // namespace GUI --- 231,234 ---- Index: svmDataDialog.cpp =================================================================== RCS file: /cvsroot/echempp/GUI/Windows/Qt/EChem++/Model/svmDataDialog.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** svmDataDialog.cpp 19 Dec 2007 11:56:24 -0000 1.1 --- svmDataDialog.cpp 22 Dec 2007 15:53:16 -0000 1.2 *************** *** 323,346 **** // define class labels experiment::ConditionDataModSim* cond_data = mainWindow->getActiveConditionData(); ! if(cond_data->khs[0] == 10000 && ! cond_data->homForwardRateConstants[1] == 0) // E { labels.push_back(1); std::cout << "label = 1 " << std::endl; } ! if(cond_data->khs[0] != 10000 && ! cond_data->homForwardRateConstants[1] == 0) // Eqr { labels.push_back(2); std::cout << "label = 2 " << std::endl; } ! if(cond_data->khs[0] == 10000 && ! cond_data->homForwardRateConstants[1] != 0) // EC { labels.push_back(3); std::cout << "label = 3 " << std::endl; } ! if(cond_data->khs[0] != 10000 && ! cond_data->homForwardRateConstants[1] != 0) // EqrC { labels.push_back(4); --- 323,346 ---- // define class labels experiment::ConditionDataModSim* cond_data = mainWindow->getActiveConditionData(); ! if(cond_data->mpc.khs[0] == 10000 && ! cond_data->mpc.homForwardRateConstants[1] == 0) // E { labels.push_back(1); std::cout << "label = 1 " << std::endl; } ! if(cond_data->mpc.khs[0] != 10000 && ! cond_data->mpc.homForwardRateConstants[1] == 0) // Eqr { labels.push_back(2); std::cout << "label = 2 " << std::endl; } ! if(cond_data->mpc.khs[0] == 10000 && ! cond_data->mpc.homForwardRateConstants[1] != 0) // EC { labels.push_back(3); std::cout << "label = 3 " << std::endl; } ! if(cond_data->mpc.khs[0] != 10000 && ! cond_data->mpc.homForwardRateConstants[1] != 0) // EqrC { labels.push_back(4); Index: modelPlotWidget.cpp =================================================================== RCS file: /cvsroot/echempp/GUI/Windows/Qt/EChem++/Model/modelPlotWidget.cpp,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** modelPlotWidget.cpp 25 Mar 2007 17:45:48 -0000 1.59 --- modelPlotWidget.cpp 22 Dec 2007 15:53:16 -0000 1.60 *************** *** 460,468 **** void ! ModelPlotWidget::saveActiveData( BSUtilities::xmlw::XmlStream& xml ) { ! // std::cout << "ModelPlotWidget::saveActiveData()" << std::endl; ! ! xml << BSUtilities::xmlw::tag("model_plot_widget"); try --- 460,466 ---- void ! ModelPlotWidget::saveActiveData( const QString& fileName ) { ! // std::cout << "ModelPlotWidget::saveActiveData()" << std::endl; try *************** *** 475,591 **** VtkGraphs* graph = _page->getGraph(_activeGraph->row,_activeGraph->col); int dim = graph->dimension(); if( dim == 2 ) - { - // QTextStream outStream( outFile ); - - VtkAxisSystem<2>* axisSystem = dynamic_cast<VtkGraph<2>* >(graph)->getAxisSystem(); - std::vector<VtkAxisGroup<2>* > axisGroups = axisSystem->getAxisGroups(); - std::vector<VtkCurve<2>* > curves = axisGroups[0]->getCurves(); - - std::vector<VtkAxis* > axes = axisGroups[0]->getAxes(); - std::string xAxisUnit = axes[0]->getUnit(); - std::string yAxisUnit = axes[1]->getUnit(); - - std::vector<VtkCurve<2>*>::const_iterator p = curves.begin(); - uint_t i=0; - uint_t j=0; - std::vector<std::vector<double> > data; - - xml << BSUtilities::xmlw::tag("data") - - << BSUtilities::xmlw::attr("x_unit") << xAxisUnit - - << BSUtilities::xmlw::attr("y_unit") << yAxisUnit; - - for(;p!=curves.end();++p) { ! (*p)->getValues(data); ! xml << BSUtilities::xmlw::tag("curve") ! ! << BSUtilities::xmlw::attr("ID") << (*p)->getIdentifier() ! ! << BSUtilities::xmlw::attr("size") << data.size() ! ! << BSUtilities::xmlw::chardata() << "<![CDATA[" << "\n"; ! for(i=0;i<data.size();++i) ! { ! for(j=0;j<data[i].size();++j) { ! xml << data[i][j] << " "; } - xml << "\n"; - } - xml << "]]>"; - - xml << BSUtilities::xmlw::endtag("curve"); - - } - - xml << BSUtilities::xmlw::endtag("data"); ! } else if( dim == 3 ) ! { ! // QTextStream outStream( outFile ); ! ! VtkAxisSystem<3>* axisSystem = dynamic_cast<VtkGraph<3>* >(graph)->getAxisSystem(); ! std::vector<VtkAxisGroup<3>* > axisGroups = axisSystem->getAxisGroups(); ! ! std::vector<VtkAxis* > axes = axisGroups[0]->getAxes(); ! std::string xAxisUnit = axes[0]->getUnit(); ! std::string yAxisUnit = axes[1]->getUnit(); ! std::string zAxisUnit = axes[2]->getUnit(); ! std::vector<VtkCurve<3>* > curves = axisGroups[0]->getCurves(); ! std::vector<VtkCurve<3>*>::const_iterator p = curves.begin(); ! uint_t i=0; ! uint_t j=0; ! std::vector<std::vector<double> > data; ! ! xml << BSUtilities::xmlw::tag("data") ! ! << BSUtilities::xmlw::attr("x_unit") << xAxisUnit ! ! << BSUtilities::xmlw::attr("y_unit") << yAxisUnit ! ! << BSUtilities::xmlw::attr("z_unit") << zAxisUnit ! ! << BSUtilities::xmlw::chardata() << "<![CDATA[" << "\n"; ! ! for(;p!=curves.end();++p) ! { ! (*p)->getValues(data); ! xml << "Curve Id:" << (*p)->getIdentifier() << "\n"; ! ! for(i=0;i<data.size();++i) ! { ! for(j=0;j<data[i].size();++j) { ! xml << data[i][j] << " "; } - xml << "\n"; - } } ! ! xml << "]]>" ! ! << BSUtilities::xmlw::endtag("data"); ! ! } } catch( VisualizationError& error ) ! { ! QMessageBox::warning( 0, "Visualization Error", ! error.message().c_str(), ! QMessageBox::Ok, ! QMessageBox::NoButton, ! QMessageBox::NoButton ); ! } ! ! ! xml << BSUtilities::xmlw::endtag("model_plot_widget"); } --- 473,544 ---- VtkGraphs* graph = _page->getGraph(_activeGraph->row,_activeGraph->col); int dim = graph->dimension(); + + experiment::ModelPlotWidgetData mpwd; if( dim == 2 ) { ! VtkAxisSystem<2>* axisSystem = dynamic_cast<VtkGraph<2>* >(graph)->getAxisSystem(); ! std::vector<VtkAxisGroup<2>* > axisGroups = axisSystem->getAxisGroups(); ! std::vector<VtkCurve<2>* > curves = axisGroups[0]->getCurves(); ! std::vector<VtkCurve<2>*>::const_iterator p = curves.begin(); ! std::vector<VtkAxis* > axes = axisGroups[0]->getAxes(); ! mpwd.x_unit = axes[0]->getUnit(); ! mpwd.x_unit = axes[1]->getUnit(); ! mpwd.z_unit = "none"; ! for(;p!=curves.end();++p) { ! (*p)->getValues(mpwd.data); ! mpwd.ids.push_back((*p)->getIdentifier()); } ! } else if( dim == 3 ) ! { ! VtkAxisSystem<3>* axisSystem = dynamic_cast<VtkGraph<3>* >(graph)->getAxisSystem(); ! std::vector<VtkAxisGroup<3>* > axisGroups = axisSystem->getAxisGroups(); ! std::vector<VtkCurve<3>* > curves = axisGroups[0]->getCurves(); ! std::vector<VtkCurve<3>*>::const_iterator p = curves.begin(); + std::vector<VtkAxis* > axes = axisGroups[0]->getAxes(); + mpwd.x_unit = axes[0]->getUnit(); + mpwd.y_unit = axes[1]->getUnit(); + mpwd.z_unit = axes[2]->getUnit(); ! for(;p!=curves.end();++p) { ! (*p)->getValues(mpwd.data); ! mpwd.ids.push_back((*p)->getIdentifier()); } } ! ! std::ofstream ofs_xml(fileName.ascii()); ! if(!ofs_xml) ! { ! QMessageBox::warning( 0, QObject::tr( "I/O Warning" ), ! QObject::tr( "Cannot open file %1" ).arg( fileName.ascii() ) ); ! return; ! } ! boost::archive::xml_oarchive oa_xml(ofs_xml); ! try{ ! oa_xml << BOOST_SERIALIZATION_NVP(mpwd); ! } ! catch(std::exception& e) ! { ! QMessageBox::critical( 0, QObject::tr( "Critical Error" ), ! QObject::tr(e.what()) ); ! ofs_xml.close(); ! return; ! } ! ofs_xml.close(); } catch( VisualizationError& error ) ! { ! QMessageBox::warning( 0, "Visualization Error", ! error.message().c_str(), ! QMessageBox::Ok, ! QMessageBox::NoButton, ! QMessageBox::NoButton ); ! } } Index: experimentDialog.cpp =================================================================== RCS file: /cvsroot/echempp/GUI/Windows/Qt/EChem++/Model/experimentDialog.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** experimentDialog.cpp 19 Dec 2007 11:52:45 -0000 1.15 --- experimentDialog.cpp 22 Dec 2007 15:53:16 -0000 1.16 *************** *** 37,42 **** #include "Model/modelError.hpp" - #include "xmlReader.h" - #include <qcombobox.h> #include <qradiobutton.h> --- 37,40 ---- *************** *** 835,958 **** } - void - ExperimentDialog::save( BSUtilities::xmlw::XmlStream& xml ) - { - // e.g. - // <experiment_dialog dim="1" transport="semi-infinite diffusion" safety="3" boundary1="0" boundary2="1"> - // <excitation boundary="0" control="potential" technique="CV" file="/home/kl/echempp/data/excitationEox.xml"/> - // </experiment_dialog> - - - // <experiment_dialog dim="1" transport="finite diffusion" distance="0.005" boundary1="0" boundary2="1"> - // <excitation boundary="0" control="potential" technique="CV" file="/home/kl/echempp/data/excitation3_1.xml"></excitation> - // <excitation boundary="1" control="potential" technique="CV" file="/home/kl/echempp/data/excitation3_2.xml"></excitation> - // </experiment_dialog> - ::experiment::ConditionDataModSim* _cond_data = _mainWindow->getActiveConditionData(); - - xml << BSUtilities::xmlw::tag("experiment_dialog") - - << BSUtilities::xmlw::attr("dim") << 1 - - << BSUtilities::xmlw::attr("transport"); - - if( _semiRadioButton->isChecked() ) - { - xml << "semi-infinite diffusion" - << BSUtilities::xmlw::attr("safety") << _cond_data->safety; - } - else if( _finiteRadioButton->isChecked() ) - { - xml << "finite diffusion" - << BSUtilities::xmlw::attr("distance") << _cond_data->finiteDistance - << BSUtilities::xmlw::attr("electrodes"); - - if( _electrodeCheckBox->isChecked() ) - { - xml << 2; - } - else - { - xml << 1; - } - - } - else - { - throw ModelError("Inconsistent transport settings in ExperimentDialog::save()!"); - } - - xml << BSUtilities::xmlw::attr("boundary1") << _cond_data->boundary0 - << BSUtilities::xmlw::attr("boundary2") << _cond_data->boundary1; - - xml << BSUtilities::xmlw::tag("excitation") - - << BSUtilities::xmlw::attr("boundary") << _cond_data->boundary0 - << BSUtilities::xmlw::attr("control") << _controlComboBox0->currentText().ascii() - << BSUtilities::xmlw::attr("technique") << _methodComboBox0->currentText().ascii(); - - if( _cond_data->potentialControlled ) - { - //_cond_data->etExcitation0.save(xml); - - xml << BSUtilities::xmlw::endtag("excitation"); - - if( _finiteRadioButton->isChecked() & _electrodeCheckBox->isChecked() ) - { - xml << BSUtilities::xmlw::tag("excitation") - - << BSUtilities::xmlw::attr("boundary") << _cond_data->boundary1 - << BSUtilities::xmlw::attr("control") << _controlComboBox1->currentText().ascii() - << BSUtilities::xmlw::attr("technique") << _methodComboBox1->currentText().ascii(); - - // _cond_data->etExcitation1.save(xml); - - xml << BSUtilities::xmlw::endtag("excitation"); - } - } - else if( _cond_data->currentControlled ) - { - // _cond_data->itExcitation0.save(xml); - - xml << BSUtilities::xmlw::endtag("excitation"); - - if( _finiteRadioButton->isChecked() & _electrodeCheckBox->isChecked() ) - { - xml << BSUtilities::xmlw::tag("excitation") - - << BSUtilities::xmlw::attr("boundary") << _cond_data->boundary1 - << BSUtilities::xmlw::attr("control") << _controlComboBox1->currentText().ascii() - << BSUtilities::xmlw::attr("technique") << _methodComboBox1->currentText().ascii(); - - // _cond_data->itExcitation1.save(xml); - - xml << BSUtilities::xmlw::endtag("excitation"); - } - } - - - xml << BSUtilities::xmlw::endtag("experiment_dialog"); - - - } - - void - ExperimentDialog::supply( const QDomElement& dialog ) - { - // std::cout << "ExperimentDialog::supply()" << std::endl; - if( !(dialog.nodeName() == "experiment_dialog") ) - { - QMessageBox::critical( 0, - QObject::tr( "Critical Error" ), - QObject::tr( "No experiment_dialog node given to ExperimentDialog::supply()" ) ); - return; - } - QString dimension = dialog.attribute("dim"); - if( dimension == "1" ) - { - this->createGeometry1D( dialog ); - } - // std::cout << "ExperimentDialog::supply() -- END" << std::endl; - } - void ExperimentDialog::supply() { --- 833,836 ---- Index: modelMainWindow.cpp =================================================================== RCS file: /cvsroot/echempp/GUI/Windows/Qt/EChem++/Model/modelMainWindow.cpp,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** modelMainWindow.cpp 19 Dec 2007 18:01:34 -0000 1.59 --- modelMainWindow.cpp 22 Dec 2007 15:53:16 -0000 1.60 *************** *** 380,401 **** } - void - ModelMainWindow::loadProject( const std::string& file ) - { - try - { - _mediator->readProjectFile( file ); - } - catch( const ModelError& error ) - { - QMessageBox::warning( 0, "Model Error", - error.message(), - QMessageBox::Ok, - QMessageBox::NoButton, - QMessageBox::NoButton ); - } - - } - void ModelMainWindow::readXML(const char* filename) { --- 380,383 ---- *************** *** 437,444 **** try { - // _mediator->readProjectFile( fileName ); readXML(fileName.ascii()); - - this->setCaption("EChem++ - ModSim " + temp ); --- 419,423 ---- *************** *** 485,490 **** ep->set_title(fileName.ascii()); std::ofstream ofs_xml(fileName.ascii()); boost::archive::xml_oarchive oa_xml(ofs_xml); ! oa_xml << BOOST_SERIALIZATION_NVP(ep); ofs_xml.close(); } --- 464,486 ---- ep->set_title(fileName.ascii()); std::ofstream ofs_xml(fileName.ascii()); + if(!ofs_xml) + { + QMessageBox::warning( 0, QObject::tr( "I/O Warning" ), + QObject::tr( "Cannot open file %1" ).arg( fileName.ascii() ) ); + delete fd; + return; + } boost::archive::xml_oarchive oa_xml(ofs_xml); ! try{ ! oa_xml << BOOST_SERIALIZATION_NVP(ep); ! } ! catch(std::exception& e) ! { ! QMessageBox::critical( 0, QObject::tr( "Critical Error" ), ! QObject::tr(e.what()) ); ! ofs_xml.close(); ! delete fd; ! return; ! } ofs_xml.close(); } *************** *** 784,789 **** { // see save project ! _mediator->writeDataFile( fileName ); ! // _plotWidget->exportActiveGraph(file,"txt"); } else --- 780,785 ---- { // see save project ! // TODO FIXME ! // _mediator->writeDataFile( fileName ); } else Index: solverDialog.cpp =================================================================== RCS file: /cvsroot/echempp/GUI/Windows/Qt/EChem++/Model/solverDialog.cpp,v retrieving revision 1.88 retrieving revision 1.89 diff -C2 -d -r1.88 -r1.89 *** solverDialog.cpp 19 Dec 2007 11:52:51 -0000 1.88 --- solverDialog.cpp 22 Dec 2007 15:53:16 -0000 1.89 *************** *** 284,381 **** } - void - SolverDialog::save( BSUtilities::xmlw::XmlStream& xml ) - { - // <solver_dialog> - // <solver time_scheme="ROS3P" time_controller="Lang" tolerance="1e-3" model_type="PDAE" auto_tols="1"/> - // <time_steps k1="" k2="" tau_init="" tau_max=""/> - // <grid_adaption coarsening="" max_level="" gamma="" alpha="" mue=""/> - // <init_mesh no_elements="" no_refinements="" fixed=""/> - // </solver_dialog> - - experiment::ConditionDataModSim* _cond_data = _mainWindow->getActiveConditionData(); - - xml << BSUtilities::xmlw::tag("solver_dialog"); - - xml << BSUtilities::xmlw::tag("solver") - << BSUtilities::xmlw::attr("time_scheme") << _cond_data->sc.timeScheme - << BSUtilities::xmlw::attr("time_controller") << _cond_data->sc.timeController - << BSUtilities::xmlw::attr("tolerance") << _cond_data->sc.TOL - << BSUtilities::xmlw::attr("model_type"); - - if( _residuumRB->isOn() ) - { - xml << "PDAE"; - } - else if( _gradientRB->isOn() ) - { - xml << "postProcessing"; - } - - xml << BSUtilities::xmlw::attr("auto_tols"); - - if(_tolCheckBox->isChecked()) - { - xml << 1; - } - else - { - xml << 0; - } - - xml << BSUtilities::xmlw::attr("step_policy"); - - if( _stepCheckBox->isChecked() ) - { - xml << 1; - } - else - { - xml << 0; - } - - xml << BSUtilities::xmlw::endtag("solver"); - - xml << BSUtilities::xmlw::tag("time_steps") - << BSUtilities::xmlw::attr("k1") << _cond_data->sc.k1 - << BSUtilities::xmlw::attr("k2") << _cond_data->sc.k2 - << BSUtilities::xmlw::attr("t_init") << _cond_data->sc.initTime - << BSUtilities::xmlw::attr("conc_init") << _cond_data->sc.initConcTol - << BSUtilities::xmlw::attr("tau_init") << _cond_data->sc.initStepSize - << BSUtilities::xmlw::attr("tau_max") << _cond_data->sc.maxStepSize - << BSUtilities::xmlw::attr("max_rej") << _cond_data->sc.maxRej - << BSUtilities::xmlw::attr("shrink") << _cond_data->sc.shrink - << BSUtilities::xmlw::attr("growth") << _cond_data->sc.growth - << BSUtilities::xmlw::attr("safety") << _cond_data->sc.safety - << BSUtilities::xmlw::endtag("time_steps"); - - xml << BSUtilities::xmlw::tag("grid_adaption") - << BSUtilities::xmlw::attr("coarsening") << _cond_data->sc.theta - << BSUtilities::xmlw::attr("max_level") << _cond_data->sc.maxLevel - << BSUtilities::xmlw::attr("gamma") << _cond_data->sc.gamma - << BSUtilities::xmlw::attr("alpha") << _cond_data->sc.alpha - << BSUtilities::xmlw::attr("mue") << _cond_data->sc.mue - << BSUtilities::xmlw::endtag("grid_adaption"); - - xml << BSUtilities::xmlw::tag("init_mesh") - << BSUtilities::xmlw::attr("no_elements") << _cond_data->sc.noElements - << BSUtilities::xmlw::attr("no_refinements") << _cond_data->sc.noRefinements - << BSUtilities::xmlw::attr("fixed"); - - if(_fixCheckBox->isChecked()) - { - xml << 1; - } - else - { - xml << 0; - } - - xml << BSUtilities::xmlw::endtag("init_mesh"); - - xml << BSUtilities::xmlw::endtag("solver_dialog"); - - } - void SolverDialog::supply() { --- 284,287 ---- *************** *** 419,567 **** void - SolverDialog::supply( const QDomElement& dialog ) - { - if( !(dialog.nodeName() == "solver_dialog") ) - { - QMessageBox::critical( 0, - QObject::tr( "Critical Error" ), - QObject::tr( "No solver_dialog node given to SolverDialog::supply()" ) ); - return; - } - - experiment::ConditionDataModSim* _cond_data = _mainWindow->getActiveConditionData(); - - QDomNode node = dialog.firstChild(); - while( !node.isNull() ) - { - if( node.isElement() && node.nodeName() == "solver" ) - { - // <solver time_scheme="ROS3P" time_controller="Lang" tolerance="1e-3" model_type="PDAE" auto_tols="1"/> - QDomElement solver = node.toElement(); - - QString time_scheme = solver.attribute("time_sc... [truncated message content] |