Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HDF5-Ausgabe in Batch-Mode #23

Merged
merged 4 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,5 @@
/eLamX1Import/nbproject/private/
/ReducedInput/nbproject/private/
/ReducedInput/build/
/sis-jhdf5-batteries_included/build/
/HDF5BatchrunOutput/build/
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
build.xml.data.CRC32=9b43c779
build.xml.data.CRC32=0a54973b
build.xml.script.CRC32=45c01e36
build.xml.stylesheet.CRC32=15ca8a54@2.95
build.xml.stylesheet.CRC32=15ca8a54@2.96
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=9b43c779
nbproject/build-impl.xml.data.CRC32=0a54973b
nbproject/build-impl.xml.script.CRC32=efe92994
nbproject/build-impl.xml.stylesheet.CRC32=49aa68b0@2.95
nbproject/build-impl.xml.stylesheet.CRC32=49aa68b0@2.96
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@
<code-name-base>de.elamx.clt.plateui</code-name-base>
<suite-component/>
<module-dependencies>
<dependency>
<code-name-base>ch.systemsx.cisd.hdf5</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>1.0</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>com.ardor3d</code-name-base>
<build-prerequisite/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
*/
package de.elamx.clt.plateui.buckling.batchrun;

import ch.systemsx.cisd.hdf5.IHDF5Writer;
import de.elamx.clt.CLT_Laminate;
import de.elamx.clt.plate.Buckling;
import de.elamx.clt.plate.BucklingResult;
Expand All @@ -46,7 +47,7 @@
public class BucklingBatchRunServiceImpl implements BatchRunService{

@Override
public void performBatchTasksAndOutput(Laminat laminate, PrintStream ps, int outputType) {
public void performBatchTasksAndOutput(Laminat laminate, PrintStream ps, IHDF5Writer hdf5writer, int outputType) {
Collection<? extends BucklingModuleData> col = laminate.getLookup().lookupAll(BucklingModuleData.class);
if (col.isEmpty()){
return;
Expand All @@ -58,10 +59,19 @@ public void performBatchTasksAndOutput(Laminat laminate, PrintStream ps, int out

List<BucklingOutputWriterService> writerServices = new ArrayList<>(Lookup.getDefault().lookupAll(BucklingOutputWriterService.class));
BucklingOutputWriterService outputWriter = writerServices.get(Math.min(Math.max(outputType, 0),writerServices.size()-1));


HDF5BucklingOutputWriterService hdf5OutputWriter = null;
if (hdf5writer != null) {
List<HDF5BucklingOutputWriterService> hdf5WriterServices = new ArrayList<>(Lookup.getDefault().lookupAll(HDF5BucklingOutputWriterService.class));
hdf5OutputWriter = hdf5WriterServices.get(Math.min(Math.max(outputType, 0), hdf5WriterServices.size() - 1));
}

for (BucklingModuleData data : col){
BucklingResult result = Buckling.calc(clt_lam, data.getBucklingInput());
outputWriter.writeResults(ps, data, data.getLaminat(), result);
if (hdf5OutputWriter != null) {
hdf5OutputWriter.writeResults(hdf5writer, data, data.getLaminat(), result);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,12 @@
package de.elamx.clt.plateui.buckling.batchrun;

import de.elamx.clt.CLT_Laminate;
import de.elamx.clt.calculation.dmatrix.DMatrixPanel;
import de.elamx.clt.plate.BucklingResult;
import de.elamx.clt.plateui.buckling.BucklingModuleData;
import de.elamx.laminate.Laminat;
import de.elamx.utilities.Utilities;
import java.io.PrintStream;
import java.util.Locale;
import org.openide.util.NbBundle;
import org.openide.util.lookup.ServiceProvider;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* This program developed in Java is based on the netbeans platform and is used
* to design and to analyse composite structures by means of analytical and
* numerical methods.
*
* Further information can be found here:
* http://www.elamx.de
*
* Copyright (C) 2021 Technische Universität Dresden - Andreas Hauffe
*
* This file is part of eLamX².
*
* eLamX² is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* eLamX² is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with eLamX². If not, see <http://www.gnu.org/licenses/>.
*/
package de.elamx.clt.plateui.buckling.batchrun;

import ch.systemsx.cisd.hdf5.IHDF5Writer;
import de.elamx.clt.plate.BucklingResult;
import de.elamx.clt.plateui.buckling.BucklingModuleData;
import de.elamx.laminate.Laminat;

/**
*
* @author Florian Dexl
*/
public interface HDF5BucklingOutputWriterService {
public void writeResults(IHDF5Writer hdf5writer, BucklingModuleData data, Laminat laminate, BucklingResult result);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/*
* This program developed in Java is based on the netbeans platform and is used
* to design and to analyse composite structures by means of analytical and
* numerical methods.
*
* Further information can be found here:
* http://www.elamx.de
*
* Copyright (C) 2021 Technische Universität Dresden - Andreas Hauffe
*
* This file is part of eLamX².
*
* eLamX² is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* eLamX² is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with eLamX². If not, see <http://www.gnu.org/licenses/>.
*/
package de.elamx.clt.plateui.buckling.batchrun;

import ch.systemsx.cisd.hdf5.IHDF5Writer;
import de.elamx.clt.CLT_Laminate;
import de.elamx.clt.plate.BucklingResult;
import de.elamx.clt.plateui.buckling.BucklingModuleData;
import de.elamx.laminate.Laminat;
import org.openide.util.lookup.ServiceProvider;

/**
*
* @author Florian Dexl
*/
@ServiceProvider(service=HDF5BucklingOutputWriterService.class, position=1)
public class HDF5BucklingOutputWriterServiceImpl implements HDF5BucklingOutputWriterService{

@Override
public void writeResults(IHDF5Writer hdf5writer, BucklingModuleData data, Laminat laminate, BucklingResult result){
String bucklingGroup = "laminates/".concat(data.getLaminat().getName().concat("/buckling/"));
if (!hdf5writer.object().exists(bucklingGroup)) {
hdf5writer.object().createGroup(bucklingGroup);
}
String groupName = bucklingGroup.concat(data.getName());
hdf5writer.object().createGroup(groupName);

double [][] dmat;
String dMatrixOption;
if (data.getBucklingInput().isDtilde()) {
dmat = data.getLaminat().getLookup().lookup(CLT_Laminate.class).getDtildeMatrix();
dMatrixOption = "D-tilde matrix";
} else if(!data.getBucklingInput().isWholeD()) {
dmat = data.getLaminat().getLookup().lookup(CLT_Laminate.class).getDMatrixWithZeroD12D16();
dMatrixOption = "D matrix with D_{16} = D_{26} = 0";
} else {
dmat = data.getLaminat().getLookup().lookup(CLT_Laminate.class).getDMatrix();
dMatrixOption = "Original D matrix";
}

hdf5writer.float64().createMatrix(groupName.concat("/D matrix used"), 3, 3);
hdf5writer.float64().writeMatrix(groupName.concat("/D matrix used"), dmat);
hdf5writer.string().setAttr(groupName.concat("/D matrix used"), "D matrix option", dMatrixOption);

hdf5writer.object().createGroup(groupName.concat("/critical load"));
double[] ncrit = result.getN_crit();
hdf5writer.float64().write(groupName.concat("/critical load/nx_crit"), ncrit[0]);
hdf5writer.float64().write(groupName.concat("/critical load/ny_crit"), ncrit[1]);
hdf5writer.float64().write(groupName.concat("/critical load/nxy_crit"), ncrit[2]);

double[] eigenvalues = result.getEigenvalues_();
int numberOfEigenvalues = eigenvalues.length;
hdf5writer.float64().createArray(groupName.concat("/eigenvalues"), numberOfEigenvalues);
hdf5writer.float64().writeArray(groupName.concat("/eigenvalues"), eigenvalues);
hdf5writer.int32().setAttr(groupName.concat("/eigenvalues"), "number of eigenvalues", numberOfEigenvalues);
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
build.xml.data.CRC32=0204c774
build.xml.data.CRC32=d065e83a
build.xml.script.CRC32=4f56e485
build.xml.stylesheet.CRC32=15ca8a54@2.95
build.xml.stylesheet.CRC32=15ca8a54@2.96
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=0204c774
nbproject/build-impl.xml.data.CRC32=d065e83a
nbproject/build-impl.xml.script.CRC32=76228f8e
nbproject/build-impl.xml.stylesheet.CRC32=49aa68b0@2.95
nbproject/build-impl.xml.stylesheet.CRC32=49aa68b0@2.96
8 changes: 8 additions & 0 deletions Classical_Laminated_Plate_Theory_UI/nbproject/project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@
<code-name-base>de.elamx.clt.calculation</code-name-base>
<suite-component/>
<module-dependencies>
<dependency>
<code-name-base>ch.systemsx.cisd.hdf5</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>1.0</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>de.elamx.clt</code-name-base>
<build-prerequisite/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
*/
package de.elamx.clt.calculation.batchrun;

import ch.systemsx.cisd.hdf5.IHDF5Writer;
import de.elamx.clt.CLT_Calculator;
import de.elamx.clt.CLT_Laminate;
import de.elamx.clt.CLT_LayerResult;
Expand All @@ -46,23 +47,33 @@
public class CalculationBatchRunServiceImpl implements BatchRunService {

@Override
public void performBatchTasksAndOutput(Laminat laminate, PrintStream ps, int outputType) {
public void performBatchTasksAndOutput(Laminat laminate, PrintStream ps, IHDF5Writer hdf5writer, int outputType) {
Collection<? extends CalculationModuleData> col = laminate.getLookup().lookupAll(CalculationModuleData.class);
if (col.isEmpty()){
if (col.isEmpty()) {
return;
}
CLT_Laminate clt_lam = laminate.getLookup().lookup(CLT_Laminate.class);
if (clt_lam == null) {
clt_lam = new CLT_Laminate(laminate);
}

List<CalculationOutputWriterService> writerServices = new ArrayList<>(Lookup.getDefault().lookupAll(CalculationOutputWriterService.class));
CalculationOutputWriterService outputWriter = writerServices.get(Math.min(Math.max(outputType, 0),writerServices.size()-1));

CalculationOutputWriterService outputWriter = writerServices.get(Math.min(Math.max(outputType, 0), writerServices.size() - 1));

HDF5CalculationOutputWriterService hdf5OutputWriter = null;
if (hdf5writer != null) {
List<HDF5CalculationOutputWriterService> hdf5WriterServices = new ArrayList<>(Lookup.getDefault().lookupAll(HDF5CalculationOutputWriterService.class));
hdf5OutputWriter = hdf5WriterServices.get(Math.min(Math.max(outputType, 0), hdf5WriterServices.size() - 1));

}

for (CalculationModuleData data : col) {
CLT_Calculator.determineValues(clt_lam, data.getDataHolder().getLoad(), data.getDataHolder().getStrains(), data.getDataHolder().isUseStrains());
CLT_LayerResult[] layerResults = CLT_Calculator.getLayerResults(data.getLaminat().getLookup().lookup(CLT_Laminate.class), data.getDataHolder().getLoad(), data.getDataHolder().getStrains());
outputWriter.writeResults(ps, data, data.getDataHolder().getLoad(), data.getDataHolder().getStrains(), layerResults);
if (hdf5OutputWriter != null) {
hdf5OutputWriter.writeResults(hdf5writer, data, data.getDataHolder().getLoad(), data.getDataHolder().getStrains(), layerResults);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* This program developed in Java is based on the netbeans platform and is used
* to design and to analyse composite structures by means of analytical and
* numerical methods.
*
* Further information can be found here:
* http://www.elamx.de
*
* Copyright (C) 2021 Technische Universität Dresden - Andreas Hauffe
*
* This file is part of eLamX².
*
* eLamX² is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* eLamX² is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with eLamX². If not, see <http://www.gnu.org/licenses/>.
*/
package de.elamx.clt.calculation.batchrun;

import ch.systemsx.cisd.hdf5.IHDF5Writer;
import de.elamx.clt.CLT_LayerResult;
import de.elamx.clt.Loads;
import de.elamx.clt.Strains;
import de.elamx.clt.calculation.CalculationModuleData;

/**
*
* @author Florian Dexl
*/
public interface HDF5CalculationOutputWriterService {
public void writeResults(IHDF5Writer hdf5writer, CalculationModuleData data, Loads loads, Strains strain, CLT_LayerResult[] results);
}
Loading