Skip to content

Commit

Permalink
Merge pull request #45 from frkasper/2410
Browse files Browse the repository at this point in the history
2410 cycle
  • Loading branch information
frkasper authored Jan 14, 2025
2 parents 91799b1 + 5e1a449 commit 81f853e
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 48 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ MacroUtils is a collection of high-level APIs in order to make your life easier

## Requires

1. Simcenter STAR-CCM+ 2406 libraries;
1. Simcenter STAR-CCM+ 2410 libraries;

1. Integrated development environment (IDE) supporting JDK 21.0.1 and gradle
1. Integrated development environment (IDE) supporting JDK 21.0.2 and gradle

## Recommended IDE

NetBeans 19 or later.
NetBeans 21 or later.

## Need an older version?

Expand Down
2 changes: 1 addition & 1 deletion macroutils/src/macroutils/MacroUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
*
* @since STAR-CCM+ v7.02, May of 2012
* @author Fabio Kasper
* @version 2406
* @version 2410
*/
public final class MacroUtils {

Expand Down
1 change: 0 additions & 1 deletion macroutils/src/macroutils/creator/CreateScene.java
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,6 @@ private Scene _initScene(StaticDeclarations.Scene type, boolean vo) {
Scene scn = _sim.getSceneManager().createScene();
scn.setPresentationName(type.getType());
scn.resetCamera();
_get.objects.hardcopyProperties(scn, false).setUseCurrentResolution(false);
scn.setDepthPeel(false);
AnnotationProp ap = scn.getAnnotationPropManager().getAnnotationProp("Logo");
((FixedAspectAnnotationProp) ap).setLocation(DisplayLocationMode.FOREGROUND);
Expand Down
6 changes: 3 additions & 3 deletions macroutils/src/macroutils/setter/SetMesh.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import star.prismmesher.NumPrismLayers;
import star.prismmesher.PartsCustomPrismsOption;
import star.prismmesher.PartsCustomizePrismMesh;
import star.prismmesher.PrismAutoMesher;
import star.prismmesher.PrismLayerCoreLayerAspectRatio;
import star.prismmesher.PrismLayerGapFillPercentage;
import star.prismmesher.PrismLayerMinimumThickness;
Expand Down Expand Up @@ -294,7 +293,8 @@ public void prisms(CustomMeshControl cmc, int numLayers, double stretch,
public void surfaceCurvature(SurfaceCurvature sc, double n, boolean vo) {
_io.say.action("Setting Surface Curvature", (NamedObject) sc.getParent().getParent(), vo);
sc.setNumPointsAroundCircle(n);
_io.say.value("Surface Curvature Points/Curve", sc.getNumPointsAroundCircle(), true);
_io.say.value("Surface Curvature Points/Curve",
sc.getNumPointsAroundCircleQuantity().evaluate(), true);
_io.say.ok(vo);
}

Expand Down Expand Up @@ -325,7 +325,7 @@ public void surfaceGrowthRate(AutoMeshOperation amo, double gr, boolean vo) {
public void surfaceProximity(SurfaceProximity sp, double np, double sf, boolean vo) {
_io.say.action("Setting Surface Proximity", (NamedObject) sp.getParent().getParent(), vo);
sp.setNumPointsInGap(np);
_io.say.value("Number of Points in Gap", sp.getNumPointsInGap(), true);
_io.say.value("Number of Points in Gap", sp.getNumPointsInGapQuantity().evaluate(), true);
_set.object.physicalQuantity(sp.getFloor(), sf, _ud.defUnitLength,
"Proximity Search Floor", true);
_io.say.ok(vo);
Expand Down
21 changes: 13 additions & 8 deletions macroutils/src/macroutils/setter/SetObjects.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@
import star.common.UpdatePlot;
import star.common.VectorPhysicalQuantity;
import star.common.VectorProfile;
import star.common.ViewObject;
import star.common.WindowUpdate;
import star.flow.PressureCoefficientFunction;
import star.meshing.MeshOperationPart;
import star.meshing.PartsRelativeOrAbsoluteSize;
import star.meshing.RelativeOrAbsoluteSize;
import star.meshing.RelativeSize;
import star.post.SolutionHistory;
import star.vis.ExportResolution;
import star.vis.Scene;

/**
Expand Down Expand Up @@ -231,10 +233,16 @@ public void saveToFile(NamedObject no, int resx, int resy, boolean vo) {
_io.say.action("Setting Save To File", vo);
_io.say.object(no, vo);
String picsPath = "pics_" + _get.strings.friendlyFilename(no.getPresentationName());
if (no instanceof Scene) {
_setWU(((Scene) no).getSceneUpdate(), picsPath, resx, resy);
} else if (no instanceof StarPlot) {
_setWU(((UpdatePlot) no).getPlotUpdate(), picsPath, resx, resy);
if (no instanceof ViewObject view) {
view.setExportResolution(ExportResolution.CUSTOM);
view.setExportWidth(resx);
view.setExportHeight(resy);
}
if (no instanceof Scene scene) {
_setWU(scene.getSceneUpdate(), picsPath);
}
if (no instanceof UpdatePlot plot) {
_setWU(plot.getPlotUpdate(), picsPath);
}
_io.say.ok(vo);
}
Expand Down Expand Up @@ -340,13 +348,10 @@ private void _setVPQ(VectorPhysicalQuantity vpq, double[] vals, Units u, String
}
}

private void _setWU(WindowUpdate wu, String pp, int resx, int resy) {
private void _setWU(WindowUpdate wu, String pp) {
wu.setSaveAnimation(true);
wu.setAnimationFilePath(new File(_ud.simPath, pp));
wu.setAnimationFilenameBase("pic");
wu.getHardcopyProperties().setUseCurrentResolution(false);
wu.getHardcopyProperties().setOutputWidth(resx);
wu.getHardcopyProperties().setOutputHeight(resy);
}

}
2 changes: 1 addition & 1 deletion macroutils/src/macroutils/setter/SetSolver.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import star.coupledflow.CoupledFlowModel;
import star.coupledflow.CoupledImplicitSolver;
import star.coupledflow.CoupledSolver;
import star.emp.GranularTemperatureTransportSolver;
import star.flow.FlowUpwindOption;
import star.keturb.KeTurbSolver;
import star.keturb.KeTurbViscositySolver;
Expand All @@ -36,7 +37,6 @@
import star.metrics.LimiterMethodOption;
import star.mixturemultiphase.SegregatedMmpSolver;
import star.mixturemultiphase.SegregatedVolumeFractionSingleStepSolver;
import star.multiphase.GranularTemperatureTransportSolver;
import star.rsturb.RsTurbSolver;
import star.rsturb.RsTurbViscositySolver;
import star.segregatedenergy.SegregatedEnergySolver;
Expand Down
53 changes: 30 additions & 23 deletions tests/macros/common/SummaryWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -257,16 +257,15 @@ private void collectDataSet(StarPlot sp, DataSet ds) {
final String info = mu.get.strings.information(sp);

String key = isMonitorPlot ? info : info + " -> " + ds.getPresentationName();
Arrays.stream(ds.getSeriesLabels()).forEach(sl -> collectDataSetSeries(key, ds, sl));
collectDataSetSeries(key, ds);

}

private void collectDataSetSeries(String key, DataSet ds, String seriesName) {
private void collectDataSetSeries(String key, DataSet ds) {

int i = Arrays.asList(ds.getSeriesLabels()).indexOf(seriesName);

final double[] xx = ds.getXSeries(i);
final double[] yy = ds.getYSeries(i);
final double[] xx = ds.getXValues();
final double[] yy = ds.getYValues();
final String seriesName = ds.getSeriesName();

if (xx.length > 50) {
INFORMATION.add(getPair(key + " -> " + seriesName + " -> Samples", xx.length));
Expand Down Expand Up @@ -305,8 +304,7 @@ private void collectMonitor(Monitor m) {

String key = mu.get.strings.information(m);

if (m instanceof ReportMonitor) {
ReportMonitor rm = (ReportMonitor) m;
if (m instanceof ReportMonitor rm) {
INFORMATION.add(getPair(key + " -> Samples", rm.getAllYValues().length));
INFORMATION.add(getPair(key + " -> Report", rm.getReport().getPresentationName()));
}
Expand Down Expand Up @@ -360,25 +358,34 @@ private String getDisplayerInfo(Displayer displayer) {
}

private Legend getLegend(Displayer displayer) {
if (displayer instanceof ScalarDisplayer) {
return ((ScalarDisplayer) displayer).getLegend();
} else if (displayer instanceof VectorDisplayer) {
return ((VectorDisplayer) displayer).getLegend();
} else if (displayer instanceof StreamDisplayer) {
return ((StreamDisplayer) displayer).getLegend();
} else {
return null;
switch (displayer) {
case ScalarDisplayer scalarDisplayer -> {
return scalarDisplayer.getLegend();
}
case VectorDisplayer vectorDisplayer -> {
return vectorDisplayer.getLegend();
}
case StreamDisplayer streamDisplayer -> {
return streamDisplayer.getLegend();
}
default -> {
return null;
}
}
}

private <T extends DisplayQuantity> double[] getMinMax(T t) {
if (t instanceof ScalarDisplayQuantity) {
ScalarDisplayQuantity sdq = (ScalarDisplayQuantity) t;
return new double[]{ sdq.getRangeMin(), sdq.getRangeMax() };
} else {
VectorDisplayQuantity vdq = (VectorDisplayQuantity) t;
return new double[]{ vdq.getMinimumValue().getRawValue(),
vdq.getMaximumValue().getRawValue()};
switch (t) {
case ScalarDisplayQuantity sdq -> {
return new double[]{ sdq.getRangeMin(), sdq.getRangeMax() };
}
case VectorDisplayQuantity vdq -> {
return new double[]{ vdq.getMinimumValue().getRawValue(),
vdq.getMaximumValue().getRawValue()};
}
default -> {
return null;
}
}
}

Expand Down
15 changes: 7 additions & 8 deletions tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
attrs==21.4.0
iniconfig==1.1.1
packaging==21.3
pluggy==1.0.0
py==1.11.0
pyparsing==3.0.7
pytest==7.0.1
tomli==2.0.1
Package Version
--------- -------
iniconfig 2.0.0
packaging 24.2
pip 24.3.1
pluggy 1.5.0
pytest 8.3.4

0 comments on commit 81f853e

Please sign in to comment.