2222import cbit .vcell .client .task .ClientTaskDispatcher ;
2323import cbit .vcell .export .server .*;
2424import cbit .vcell .export .server .ExportSpecs .SimNameSimDataID ;
25+ import cbit .vcell .geometry .GeometrySpec ;
2526import cbit .vcell .geometry .SubVolume ;
2627import cbit .vcell .mapping .SimulationContext ;
2728import cbit .vcell .math .VariableType ;
@@ -647,7 +648,6 @@ private ExportSpecs getExportSpecs() {
647648 for (int i = 0 ; i < selections .length ; i ++) {
648649 selections [i ] = (SpatialSelection )selectionsArr [i ];
649650 }
650- SimulationContext sc = (SimulationContext ) getSimulation ().getSimulationOwner ();
651651 MathOverrides mathOverrides = getSimulation ().getMathOverrides ();
652652
653653 String [] filteredConstants = mathOverrides .getFilteredConstantNames ();
@@ -667,14 +667,25 @@ private ExportSpecs getExportSpecs() {
667667
668668 String serverSavedFileName = getExportSettings1 ().getFormatSpecificSpecs () instanceof N5Specs ? ((N5Specs ) getExportSettings1 ().getFormatSpecificSpecs ()).dataSetName : "" ;
669669
670- boolean nonSpatial = sc .getGeometry ().getDimension () == 0 ;
670+ SimulationOwner simulationOwner = getSimulation ().getSimulationOwner ();
671+ boolean nonSpatial = simulationOwner .getGeometry ().getDimension () == 0 ;
671672 HashMap <Integer , String > subVolumes = new HashMap <>();
672- for (SubVolume subVolume : sc .getGeometry ().getGeometrySpec ().getSubVolumes ()){
673+ for (SubVolume subVolume : simulationOwner .getGeometry ().getGeometrySpec ().getSubVolumes ()){
673674 subVolumes .put (subVolume .getHandle (), subVolume .getName ());
674675 }
675- HumanReadableExportData humanReadableExportData = new HumanReadableExportData (getSimulation ().getName (), sc .getName (), sc .getBioModel ().getName (),
676- differentParameterValues , serverSavedFileName , sc .getApplicationType ().name (), nonSpatial , subVolumes );
677676 GeometrySpecs geometrySpecs = new GeometrySpecs (selections , getNormalAxis (), getSlice (), geoMode );
677+
678+ HumanReadableExportData humanReadableExportData ;
679+ if (simulationOwner instanceof SimulationContext sc ){
680+ humanReadableExportData = new HumanReadableExportData (getSimulation ().getName (), sc .getName (), sc .getBioModel ().getName (),
681+ differentParameterValues , serverSavedFileName , sc .getApplicationType ().name (), nonSpatial , subVolumes );
682+ } else if (simulationOwner instanceof MathModel mathModel ){
683+ humanReadableExportData = new HumanReadableExportData (getSimulation ().getName (), mathModel .getName (), mathModel .getName (),
684+ differentParameterValues , serverSavedFileName , mathModel .getDocumentType ().name (), nonSpatial , subVolumes );
685+ } else {
686+ throw new IllegalArgumentException ("Expected " + SimulationContext .class .getName () + " or " + MathModel .class .getName ());
687+ }
688+
678689 ExportSpecs exportSpecs = new ExportSpecs (
679690 vcDataIdentifier ,
680691 getExportSettings1 ().getSelectedFormat (),
0 commit comments