Skip to content

Commit

Permalink
Add GUI changes and tinyxml2 thirdparty package.
Browse files Browse the repository at this point in the history
  • Loading branch information
ktbolt committed Aug 2, 2023
1 parent 5b48bf4 commit e70b499
Show file tree
Hide file tree
Showing 12 changed files with 5,651 additions and 36 deletions.
1 change: 1 addition & 0 deletions Code/CMake/SimVascularInternals.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ set(SV_LIBS ${SV_LIBS}
THIRDPARTY_VMTK
THIRDPARTY_ZLIB
THIRDPARTY_TINYXML
THIRDPARTY_TINYXML2
THIRDPARTY_SOLVERIO)

# Module libs
Expand Down
1 change: 1 addition & 0 deletions Code/CMake/SimVascularOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ option(SV_USE_TETGEN "Enable Tetgen Meshing Plugin" ON)
option(SV_USE_TETGEN_ADAPTOR "Option to use open source mesh adaption" ON)

option(SV_USE_TINYXML "Use TinyXML" ON)
option(SV_USE_TINYXML2 "Use TinyXML2" ON)

option(SV_USE_PYTHON "Use Python" ON)

Expand Down
4 changes: 4 additions & 0 deletions Code/CMake/SimVascularThirdParty.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ if(SV_USE_TINYXML)
else()
unset(TINYXML_LIBRARY CACHE)
endif()

simvascular_third_party(tinyxml2)
set(TINYXML2_LIBRARY ${SV_LIB_THIRDPARTY_TINYXML2_NAME})

#-----------------------------------------------------------------------------

#-----------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1402,11 +1402,16 @@ void sv4guisvFSIView::SaveRemesher()
DataChanged();
}


//-----------------
// CreateInputFile
//-----------------
// Create a text or XML input file of solver commands.
//
void sv4guisvFSIView::CreateInputFile()
{
if(!m_MitkJob)
if (!m_MitkJob) {
return;
}

QString jobPath=GetJobPath();
if(jobPath=="" || !QDir(jobPath).exists())
Expand All @@ -1415,14 +1420,33 @@ void sv4guisvFSIView::CreateInputFile()
return;
}

std::string mfsFileName=m_JobNode->GetName()+".txt";
std::string mfsFullFilePath=jobPath.toStdString()+"/"+mfsFileName;

if(m_Job->WriteFile(mfsFullFilePath))
{
m_MitkJob->SetStatus("Input file created");
m_JobNode->SetBoolProperty("dummy",true);//trigger NodeChanged to update job status
mitk::StatusBar::GetInstance()->DisplayText("Input file (.msf) have been created.");
// If the 'xml_format_radioButton' is selected then write
// out an XML format file for svFSIplus.
//
bool xml_format = ui->xml_format_radioButton->isChecked();

if (xml_format) {
std::string mfsFileName=m_JobNode->GetName()+".xml";
std::string mfsFullFilePath=jobPath.toStdString()+"/"+mfsFileName;

if (m_Job->WriteXmlFile(mfsFullFilePath)) {
m_MitkJob->SetStatus("Input XML file created");
m_JobNode->SetBoolProperty("dummy",true);//trigger NodeChanged to update job status
mitk::StatusBar::GetInstance()->DisplayText("Input file (.msf) have been created.");
}

// Write out a plain text format file for svFSI.
//
} else {
std::string mfsFileName=m_JobNode->GetName()+".txt";
std::string mfsFullFilePath=jobPath.toStdString()+"/"+mfsFileName;

if (m_Job->WriteFile(mfsFullFilePath)) {
m_MitkJob->SetStatus("Input file created");
m_JobNode->SetBoolProperty("dummy",true);//trigger NodeChanged to update job status
mitk::StatusBar::GetInstance()->DisplayText("Input file (.msf) have been created.");
}
}
}

Expand Down
67 changes: 40 additions & 27 deletions Code/Source/sv4gui/Plugins/org.sv.gui.qt.svfsi/sv4gui_svFSIView.ui
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>434</width>
<width>449</width>
<height>581</height>
</rect>
</property>
Expand Down Expand Up @@ -1929,7 +1929,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>434</width>
<width>449</width>
<height>609</height>
</rect>
</property>
Expand Down Expand Up @@ -2436,6 +2436,26 @@
</property>
</spacer>
</item>
<item row="2" column="0">
<widget class="QPushButton" name="btnStopSim">
<property name="text">
<string>Stop</string>
</property>
</widget>
</item>
<item row="4" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="QWidget" name="widgetRun" native="true">
<layout class="QGridLayout" name="gridLayout_42">
Expand All @@ -2454,17 +2474,30 @@
<property name="spacing">
<number>5</number>
</property>
<item row="2" column="1">
<widget class="ctkSliderWidget" name="sliderNumProcs" native="true"/>
<item row="0" column="1">
<widget class="QRadioButton" name="xml_format_radioButton">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If selected then write the solver commands in XML format used by svFSIplus.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>XML Format</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="2">
<item row="0" column="0">
<widget class="QPushButton" name="btnCreateInputFile">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Create Input File</string>
</property>
</widget>
</item>
<item row="2" column="0">
<item row="1" column="1">
<widget class="ctkSliderWidget" name="sliderNumProcs" native="true"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_5">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
Expand All @@ -2477,7 +2510,7 @@
</property>
</widget>
</item>
<item row="6" column="0" colspan="2">
<item row="2" column="0" colspan="2">
<widget class="QPushButton" name="btnRunSim">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
Expand All @@ -2496,26 +2529,6 @@
</layout>
</widget>
</item>
<item row="4" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0">
<widget class="QPushButton" name="btnStopSim">
<property name="text">
<string>Stop</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
Expand Down
31 changes: 31 additions & 0 deletions Code/ThirdParty/tinyxml2/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Copyright (c) Stanford University, The Regents of the University of
# California, and others.
#
# All Rights Reserved.
#
# See Copyright-SimVascular.txt for additional details.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject
# to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#simvascular_third_party(tinyxml)
64 changes: 64 additions & 0 deletions Code/ThirdParty/tinyxml2/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Hey emacs, this is a -*- makefile -*-

# Copyright (c) Stanford University, The Regents of the University of
# California, and others.
#
# All Rights Reserved.
#
# See Copyright-SimVascular.txt for additional details.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject
# to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

TOP=../../../BuildWithMake

include $(TOP)/include.mk

TINYXML_SUBDIRS = simvascular_tinyxml

lib: createHeaderFile libsubdirs

shared:

libsubdirs:
@for i in ${TINYXML_SUBDIRS}; do ( \
cd $$i; \
$(MAKE)) ; done

clean:
for i in ${TINYXML_SUBDIRS}; do ( \
cd $$i; \
$(MAKE) clean ) ; done

veryclean: clean
rm -f simvascular_tinyxml.h
for i in ${TINYXML_SUBDIRS}; do ( \
cd $$i; \
$(MAKE) veryclean ) ; done

createHeaderFile:
rm -f simvascular_tinyxml.h
@echo "#ifndef __simvascular_tinyxml_h" > simvascular_tinyxml.h
@echo "#define __simvascular_tinyxml_h" >> simvascular_tinyxml.h
@echo "#include <simvascular_tinyxml/tinyxml.h>" >> simvascular_tinyxml.h
@echo "#endif" >> simvascular_tinyxml.h
43 changes: 43 additions & 0 deletions Code/ThirdParty/tinyxml2/simvascular_tinyxml2.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/* Copyright (c) Stanford University, The Regents of the University of
* California, and others.
*
* All Rights Reserved.
*
* See Copyright-SimVascular.txt for additional details.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject
* to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#ifndef __simvascular_tinyxml2_h
#define __simvascular_tinyxml2_h

/* Use the tinyxml library configured for SimVascular. */
#cmakedefine SV_USE_SYSTEM_TINYXML2
#ifdef SV_USE_SYSTEM_TINYXML2
# include <tinyxml.h>2
#else
# include <simvascular_tinyxml2/tinyxml2.h>
#endif

#endif
Loading

0 comments on commit e70b499

Please sign in to comment.