From 97523f324fc6924b28223b1af8ee2bf9deade8e1 Mon Sep 17 00:00:00 2001 From: fmckenna Date: Fri, 10 May 2024 09:37:51 -0700 Subject: [PATCH] fmk - mat cite name fix --- WorkflowAppHydroUQ.cpp | 38 ++++++++++++++++++++++++++++++++++++++ main.cpp | 2 +- 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/WorkflowAppHydroUQ.cpp b/WorkflowAppHydroUQ.cpp index 2b8f750..c2687aa 100644 --- a/WorkflowAppHydroUQ.cpp +++ b/WorkflowAppHydroUQ.cpp @@ -1050,3 +1050,41 @@ int WorkflowAppHydroUQ::getMaxNumParallelTasks() { return theUQ_Selection->getNumParallelTasks(); } + +int +WorkflowAppHydroUQ::createCitation(QJsonObject &citation, QString citeFile) { + + QString cit("{\"HydroUQ\": { \"citations\": [{\"citation\": \"Frank McKenna, Justin Bonus, Ajay B Harish, & Nicolette Lewis. (2024). NHERI-SimCenter/HydroUQ: Version 3.1.0 (v3.1.0). Zenodo. https://doi.org/10.5281/zenodo.10902090 \",\"description\": \"This is the overall tool reference used to indicate the version of the tool.\"},{\"citation\": \"Gregory G. Deierlein, Frank McKenna, Adam Zsarnóczay, Tracy Kijewski-Correa, Ahsan Kareem, Wael Elhaddad, Laura Lowes, Matthew J. Schoettler, and Sanjay Govindjee (2020) A Cloud-Enabled Application Framework for Simulating Regional-Scale Impacts of Natural Hazards on the Built Environment. Frontiers in the Built Environment. 6:558706. doi: 10.3389/fbuil.2020.558706\",\"description\": \" This marker paper describes the SimCenter application framework, which was designed to simulate the impacts of natural hazards on the built environment.It is a necessary attribute for publishing work resulting from the use of SimCenter tools, software, and datasets.\"}]}}"); + + QJsonDocument docC = QJsonDocument::fromJson(cit.toUtf8()); + if(!docC.isNull()) { + if(docC.isObject()) { + citation = docC.object(); + } else { + qDebug() << "WorkflowdAppEE_UQ citation text is not valid JSON: \n" << cit << endl; + } + } + theSIM->outputCitation(citation); + theEventSelection->outputCitation(citation); + theAnalysisSelection->outputCitation(citation); + theUQ_Selection->outputCitation(citation); + theEDP_Selection->outputCitation(citation); + + // write the citation to a citeFile if provided + + if (!citeFile.isEmpty()) { + + QFile file(citeFile); + if (!file.open(QFile::WriteOnly | QFile::Text)) { + errorMessage(QString("writeCitation - could not open file") + citeFile); + progressDialog->hideProgressBar(); + return 0; + } + + QJsonDocument doc(citation); + file.write(doc.toJson()); + file.close(); + } + + return 0; +} diff --git a/main.cpp b/main.cpp index f3b8f74..84e9933 100644 --- a/main.cpp +++ b/main.cpp @@ -158,7 +158,7 @@ int main(int argc, char *argv[]) w.setVersion(version); // Citation - QString citeText("1) Frank McKenna, Justin Bonus, Ajay B Harish, & Nicolette Lewis. (2024). NHERI-SimCenter/HydroUQ: Version 3.1.0 (v3.1.0). Zenodo. https://doi.org/10.5281/zenodo.10902090 \n\n 2) Deierlein GG, McKenna F, Zsarnóczay A, Kijewski-Correa T, Kareem A, Elhaddad W, Lowes L, Schoettler MJ and Govindjee S (2020) A Cloud-Enabled Application Framework for Simulating Regional-Scale Impacts of Natural Hazards on the Built Environment. Front. Built Environ. 6:558706. doi: 10.3389/fbuil.2020.558706"); + QString citeText("1) Frank McKenna, Justin Bonus, Ajay B Harish, & Nicolette Lewis. (2024). NHERI-SimCenter/HydroUQ: Version 3.1.0 (v3.1.0). Zenodo. https://doi.org/10.5281/zenodo.10902090 \n\n 2) \n\n2) Gregory G. Deierlein, Frank McKenna, Adam Zsarnóczay, Tracy Kijewski-Correa, Ahsan Kareem, Wael Elhaddad, Laura Lowes, Matthew J. Schoettler, and Sanjay Govindjee (2020) A Cloud-Enabled Application Framework for Simulating Regional-Scale Impacts of Natural Hazards on the Built Environment. Frontiers in the Built Environment. 6:558706. doi: 10.3389/fbuil.2020.558706"); w.setCite(citeText); // Link to repository