v240
This commit is contained in:
parent
551a175115
commit
b658f2e87f
1347 changed files with 70978 additions and 47412 deletions
6
.classpath
Normal file
6
.classpath
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry excluding="eu/engys/vtk/actors/" kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
/bin/
|
||||
17
.project
Normal file
17
.project
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>HELYX-OS</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
|
|
@ -1,11 +1,18 @@
|
|||
# HELYX-OS
|
||||
[HELYX-OS](http://engys.com/products/helyx-os) is an open-source Graphical User Interface designed to work natively with OpenFOAM [version 2.4.0](http://www.openfoam.org/archive/2.4.0/download/source.php). The GUI is developed by [ENGYS](http://engys.com/) using Java+[VTK](http://www.vtk.org/) and delivered to the public under the GNU General Public License.
|
||||
[HELYX-OS](http://engys.com/products/helyx-os) is an open-source Graphical User Interface designed to work natively with OpenFOAM [version 4.1](http://www.openfoam.org/archive/4.1/download/source.php) and OpenFOAM [v1606+](http://openfoam.com/download/install-binary.php). The GUI is developed by [ENGYS](http://engys.com/) using Java+[VTK](http://www.vtk.org/) and delivered to the public under the GNU General Public License.
|
||||
|
||||
HELYX-OS has been created to facilitate the usage of the standard OpenFOAM libraries, by removing the complexity of text based case definition in favour of an intuitive easy-to-use graphical user interface. The GUI is focused on pre-processing tasks, including meshing, case definition and solver execution. Visit the [HELYX-OS Project Page](http://engys.github.io/HELYX-OS/) for more information.
|
||||
|
||||
## Installing the latest binary file for 64 bit linux
|
||||
Visit [http://engys.github.io/HELYX-OS/](http://engys.github.io/HELYX-OS/) to download the latest HELYX-OS binary and view [installation instructions](http://engys.github.io/HELYX-OS/installation/).
|
||||
|
||||
## Configuring HELYX-OS for OpenFOAM v1606+
|
||||
To use OpenFOAM v1606+ installed via Docker following the instructions detailed [here](http://openfoam.com/download/install-binary.php) you need to do the following:
|
||||
- Open HELYX-OS
|
||||
- Go to Edit>Preferences
|
||||
- In the "Misc" section check the "Use Docker" tick box and then type "openfoamplus/of_v1606plus_centos66" in the "Docker Image" textbox
|
||||
- Press "OK" to apply settings
|
||||
|
||||
## Compiling HELYX-OS on your own
|
||||
|
||||
### Prerequisites
|
||||
|
|
|
|||
|
|
@ -1,22 +1,20 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<project default="dist" name="Create Runnable Jar for Project HELYXOS with libraries in sub-folder">
|
||||
<project default="dist" name="Create Jar for HELYX-OS">
|
||||
|
||||
<property name="component.name" value="HelyxOS_MOD" />
|
||||
<property name="component.version" value="2.3.1" />
|
||||
<property name="component.vendor" value="" />
|
||||
|
||||
<property name="version" value="ocfd" />
|
||||
<property name="version.name" value="OCFD" />
|
||||
<property name="component.name" value="HELYX-OS" />
|
||||
<property name="component.vendor" value="Engys" />
|
||||
<property name="component.mail" value="info@engys.com" />
|
||||
<property name="component.site" value="http://engys.github.io/HELYX-OS/" />
|
||||
<property name="component.copyright" value="Copyright © ENGYS Ltd 2016. All rights reserved." />
|
||||
<property name="component.launcher" value="eu.engys.launcher.Launcher" />
|
||||
<property name="component.version" value="2.4.0" />
|
||||
|
||||
<property name="jar.name" value="${component.name}.jar" />
|
||||
|
||||
<property name="src.dir" value="src" />
|
||||
<property name="build.dir" value="build" />
|
||||
|
||||
<property name="lib.dir" value="lib" />
|
||||
<property name="dist.dir" value="dist" />
|
||||
|
||||
<path id="main.path">
|
||||
<path id="build.path">
|
||||
<fileset dir="${lib.dir}">
|
||||
<include name="**/*.jar" />
|
||||
</fileset>
|
||||
|
|
@ -29,24 +27,27 @@
|
|||
<target name="compile" depends="init">
|
||||
<javac debug="true" destdir="${build.dir}" target="1.7" source="1.7" verbose="false" srcdir="${src.dir}" includeantruntime="false" includejavaruntime="yes">
|
||||
<include name="eu/engys/**/*.java" />
|
||||
<include name="vtk/**/*.java" />
|
||||
<classpath refid="main.path" />
|
||||
<classpath refid="build.path" />
|
||||
</javac>
|
||||
<copy todir="${build.dir}">
|
||||
<fileset dir="${src.dir}" includes="**/resources/**/*, **/*.png, **/*.jpeg, **/*.jpg, **/*.gif, **/*.properties" />
|
||||
</copy>
|
||||
<touch file="${build.dir}/eu/engys/resources/version.properties" />
|
||||
<propertyfile file="${build.dir}/eu/engys/resources/version.properties">
|
||||
<entry key="name" value="${component.name}" />
|
||||
<entry key="vendor" value="${component.vendor}" />
|
||||
<entry key="version" value="${component.version}" />
|
||||
<entry key="build" type="date" value="now" pattern="yyyy-MM-dd" />
|
||||
</propertyfile>
|
||||
<touch file="${build.dir}/eu/engys/resources/version.properties" />
|
||||
<propertyfile file="${build.dir}/eu/engys/resources/version.properties">
|
||||
<entry key="name" value="${component.name}" />
|
||||
<entry key="vendor" value="${component.vendor}" />
|
||||
<entry key="version" value="${component.version}" />
|
||||
<entry key="mail" value="${component.mail}" />
|
||||
<entry key="site" value="${component.site}" />
|
||||
<entry key="copyright" value="${component.copyright}" />
|
||||
<entry key="build" type="date" value="now" pattern="yyyy-MM-dd" />
|
||||
|
||||
</propertyfile>
|
||||
</target>
|
||||
|
||||
<target name="jar" depends="compile" description="">
|
||||
<target name="dist" depends="compile" description="">
|
||||
<pathconvert property="main.class.path" pathsep=" ">
|
||||
<path refid="main.path" />
|
||||
<path refid="build.path" />
|
||||
<mapper>
|
||||
<chainedmapper>
|
||||
<flattenmapper />
|
||||
|
|
@ -54,7 +55,6 @@
|
|||
</mapper>
|
||||
</pathconvert>
|
||||
|
||||
<!-- set the date -->
|
||||
<tstamp>
|
||||
<format property="TODAY" pattern="yyyy-MM-dd" />
|
||||
</tstamp>
|
||||
|
|
@ -64,7 +64,7 @@
|
|||
<!-- define MANIFEST.MF -->
|
||||
<manifest>
|
||||
<attribute name="Built-By" value="${user.name}" />
|
||||
<attribute name="Main-Class" value="eu.engys.helyx.gui.Launcher" />
|
||||
<attribute name="Main-Class" value="${component.launcher}" />
|
||||
<attribute name="Specification-Title" value="${component.name}" />
|
||||
<attribute name="Specification-Version" value="${component.version}" />
|
||||
<attribute name="Specification-Vendor" value="${component.vendor}" />
|
||||
|
|
@ -73,25 +73,11 @@
|
|||
<attribute name="Implementation-Vendor" value="${component.vendor}" />
|
||||
|
||||
<attribute name="Class-Path" value="${main.class.path}" />
|
||||
<attribute name="SplashScreen-Image" value="eu/engys/helyx/gui/resources/splash.png" />
|
||||
<attribute name="SplashScreen-Image" value="${component.name}.png" />
|
||||
</manifest>
|
||||
</jar>
|
||||
</target>
|
||||
|
||||
<target name="dist" depends="jar">
|
||||
<mkdir dir="${lib.dir}/old" />
|
||||
<move todir="${lib.dir}/old">
|
||||
<fileset file="${lib.dir}/core-util.jar" />
|
||||
<fileset file="${lib.dir}/core.jar" />
|
||||
<fileset file="${lib.dir}/core-gui.jar" />
|
||||
<fileset file="${lib.dir}/core-vtk.jar" />
|
||||
<fileset file="${lib.dir}/commonCFD.jar" />
|
||||
<fileset file="${lib.dir}/StandardCFD.jar" />
|
||||
<fileset file="${lib.dir}/standardVOF.jar" />
|
||||
<fileset file="${lib.dir}/HELYX-OS.jar" />
|
||||
</move>
|
||||
</target>
|
||||
|
||||
<target name="clean">
|
||||
<delete dir="${build.dir}" />
|
||||
<delete quiet="true">
|
||||
|
|
|
|||
|
|
@ -1,32 +1,30 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.application;
|
||||
|
||||
import static eu.engys.launcher.StartUpMonitor.close;
|
||||
import static eu.engys.launcher.StartUpMonitor.closeSplash;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
|
|
@ -37,6 +35,7 @@ import java.awt.event.ActionEvent;
|
|||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.util.Arrays;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.Icon;
|
||||
|
|
@ -51,202 +50,205 @@ import org.slf4j.LoggerFactory;
|
|||
import eu.engys.core.Arguments;
|
||||
import eu.engys.core.OpenFOAMEnvironment;
|
||||
import eu.engys.core.controller.Controller;
|
||||
import eu.engys.core.presentation.ActionContainer;
|
||||
import eu.engys.core.controller.Controller.OpenMode;
|
||||
import eu.engys.core.controller.OpenOptions;
|
||||
import eu.engys.core.modules.ApplicationModule;
|
||||
import eu.engys.core.presentation.ActionManager;
|
||||
import eu.engys.core.project.Model;
|
||||
import eu.engys.gui.AboutWindow;
|
||||
import eu.engys.gui.GlassPane;
|
||||
import eu.engys.gui.PreferencesBean;
|
||||
import eu.engys.gui.PreferencesDialog;
|
||||
import eu.engys.gui.events.EventManager;
|
||||
import eu.engys.gui.view.View;
|
||||
import eu.engys.gui.view3D.View3DEventListener;
|
||||
import eu.engys.util.ui.ExecUtil;
|
||||
import eu.engys.util.ui.ResourcesUtil;
|
||||
import eu.engys.util.ui.UiUtil;
|
||||
|
||||
public abstract class AbstractApplication implements Application, ActionContainer {
|
||||
public abstract class AbstractApplication implements Application {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(AbstractApplication.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(AbstractApplication.class);
|
||||
|
||||
protected JFrame frame;
|
||||
public View view;
|
||||
protected Model model;
|
||||
public Controller controller;
|
||||
protected View3DEventListener view3dListener;
|
||||
protected JFrame frame;
|
||||
public View view;
|
||||
protected Model model;
|
||||
public Controller controller;
|
||||
protected View3DEventListener view3dListener;
|
||||
|
||||
public AbstractApplication(Model model, View view, Controller controller) {
|
||||
this.model = model;
|
||||
this.view = view;
|
||||
this.controller = controller;
|
||||
}
|
||||
protected Set<ApplicationModule> modules;
|
||||
|
||||
@Override
|
||||
public JFrame getFrame() {
|
||||
return frame;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDemo() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkVersion() {
|
||||
}
|
||||
public AbstractApplication(Model model, Set<ApplicationModule> modules, View view, Controller controller) {
|
||||
this.model = model;
|
||||
this.modules = modules;
|
||||
this.view = view;
|
||||
this.controller = controller;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
initFrame();
|
||||
frame.setVisible(true);
|
||||
trySettingOpenFoamFolder();
|
||||
@Override
|
||||
public JFrame getFrame() {
|
||||
return frame;
|
||||
}
|
||||
|
||||
if (Arguments.stlFiles != null) {
|
||||
if (Arguments.baseDir != null) {
|
||||
ActionManager.getInstance().invoke("application.open");
|
||||
} else {
|
||||
ActionManager.getInstance().invoke("application.create");
|
||||
}
|
||||
} else {
|
||||
if (Arguments.baseDir != null) {
|
||||
controller.openCase(Arguments.baseDir);
|
||||
} else {
|
||||
view.showStartupDialog(this);
|
||||
}
|
||||
}
|
||||
close();
|
||||
}
|
||||
@Override
|
||||
public void checkVersion() {
|
||||
}
|
||||
|
||||
protected void trySettingOpenFoamFolder() {
|
||||
OpenFOAMEnvironment.trySettingOpenFoamFolder(frame);
|
||||
}
|
||||
@Override
|
||||
public void start(final Arguments arguments) {
|
||||
ExecUtil.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
initFrame();
|
||||
frame.setVisible(true);
|
||||
trySettingOpenFoamFolder();
|
||||
|
||||
@Override
|
||||
public void initFrame() {
|
||||
view.layoutComponents();
|
||||
frame = new JFrame(getTitle()) {
|
||||
@Override
|
||||
public void dispose() {
|
||||
EventManager.unregisterAllEventSubscriptions();
|
||||
super.dispose();
|
||||
}
|
||||
executeStartupActions(arguments);
|
||||
|
||||
/**
|
||||
* This method fixes the Synthetica laf bug that causes incorrect
|
||||
* fullscreen window size on secondary monitor.
|
||||
*/
|
||||
@Override
|
||||
public void setMaximizedBounds(Rectangle bounds) {
|
||||
GraphicsDevice currentFrame = getGraphicsConfiguration().getDevice();
|
||||
if (UiUtil.isSecondaryScreen(currentFrame) && getExtendedState() == JFrame.NORMAL) {
|
||||
super.setMaximizedBounds(UiUtil.getCurrentScreenSize(frame));
|
||||
} else {
|
||||
super.setMaximizedBounds(bounds);
|
||||
}
|
||||
}
|
||||
};
|
||||
view.setProgressMonitorParent(frame);
|
||||
closeSplash();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Dimension preferredDimension = UiUtil.getPreferredScreenSize();
|
||||
logger.info("Set dimendions to {}", preferredDimension);
|
||||
frame.setSize(preferredDimension);
|
||||
frame.setLocationRelativeTo(null);
|
||||
|
||||
UiUtil.center(frame);
|
||||
protected void executeStartupActions(Arguments arguments) {
|
||||
if (arguments.baseDir != null) {
|
||||
controller.openCase(OpenOptions.file(arguments.baseDir, OpenMode.CHECK_FOLDER_ASK_USER));
|
||||
} else {
|
||||
view.showStartupDialog(this);
|
||||
}
|
||||
}
|
||||
|
||||
frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
|
||||
protected void trySettingOpenFoamFolder() {
|
||||
OpenFOAMEnvironment.trySettingOpenFoamFolder(frame);
|
||||
}
|
||||
|
||||
frame.setIconImages(Arrays.asList(new Image[] { ((ImageIcon) getSmallIcon()).getImage(), ((ImageIcon) getBigIcon()).getImage() }));
|
||||
@Override
|
||||
public void initFrame() {
|
||||
view.layoutComponents();
|
||||
frame = new JFrame(getTitle()) {
|
||||
@Override
|
||||
public void dispose() {
|
||||
EventManager.unregisterAllEventSubscriptions();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
frame.addWindowListener(new WindowAdapter() {
|
||||
@Override
|
||||
public void windowClosing(WindowEvent e) {
|
||||
ActionManager.getInstance().invoke("application.exit");
|
||||
}
|
||||
});
|
||||
frame.setName("MainFrame");
|
||||
frame.getRootPane().updateUI();
|
||||
frame.setJMenuBar(view.getMenuBar());
|
||||
/**
|
||||
* This method fixes the Synthetica laf bug that causes incorrect fullscreen window size on secondary monitor.
|
||||
*/
|
||||
@Override
|
||||
public void setMaximizedBounds(Rectangle bounds) {
|
||||
GraphicsDevice currentFrame = getGraphicsConfiguration().getDevice();
|
||||
if (UiUtil.isSecondaryScreen(currentFrame) && getExtendedState() == JFrame.NORMAL) {
|
||||
super.setMaximizedBounds(UiUtil.getCurrentScreenSize(this));
|
||||
} else {
|
||||
super.setMaximizedBounds(bounds);
|
||||
}
|
||||
}
|
||||
};
|
||||
view.setProgressMonitorParent(frame);
|
||||
|
||||
frame.getContentPane().setLayout(new BorderLayout());
|
||||
frame.getContentPane().add(view, BorderLayout.CENTER);
|
||||
frame.getContentPane().add(view.getStatusBar(), BorderLayout.SOUTH);
|
||||
|
||||
GlassPane glassPane = new GlassPane();
|
||||
frame.setGlassPane(glassPane);
|
||||
glassPane.setVisible(false);
|
||||
|
||||
Dimension preferredDimension = UiUtil.getPreferredScreenSize();
|
||||
logger.info("Set dimendions to {}", preferredDimension);
|
||||
frame.setSize(preferredDimension);
|
||||
frame.setLocationRelativeTo(null);
|
||||
|
||||
customizeGUIFrame(view);
|
||||
}
|
||||
UiUtil.center(frame);
|
||||
|
||||
public View getView() {
|
||||
return view;
|
||||
}
|
||||
frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
|
||||
|
||||
public Model getModel() {
|
||||
return model;
|
||||
}
|
||||
frame.setIconImages(Arrays.asList(new Image[] { ((ImageIcon) getSmallIcon()).getImage(), ((ImageIcon) getBigIcon()).getImage() }));
|
||||
|
||||
public abstract String getTitle();
|
||||
frame.addWindowListener(new WindowAdapter() {
|
||||
@Override
|
||||
public void windowClosing(WindowEvent e) {
|
||||
ActionManager.getInstance().invoke(View.EXIT);
|
||||
}
|
||||
});
|
||||
frame.setName("MainFrame");
|
||||
frame.getRootPane().updateUI();
|
||||
frame.setJMenuBar(view.getMenuBar());
|
||||
|
||||
protected abstract void customizeGUIFrame(View view);
|
||||
frame.getContentPane().setLayout(new BorderLayout());
|
||||
frame.getContentPane().add(view, BorderLayout.CENTER);
|
||||
frame.getContentPane().add(view.getStatusBar(), BorderLayout.SOUTH);
|
||||
|
||||
protected void addPreferencesItem(final View view) {
|
||||
JMenuItem preferencesItem = new JMenuItem(new AbstractAction("Preferences", PREFERENCES_ICON) {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
new PreferencesDialog(isOS(), hasParaview(), hasFieldView(), hasEnsight(), hasSolverPreferences(), model.getDefaults().getDictDataFolder()).show();
|
||||
}
|
||||
});
|
||||
preferencesItem.setName("Application Preferences");
|
||||
view.getMenuBar().getEditMenu().add(preferencesItem);
|
||||
}
|
||||
GlassPane glassPane = new GlassPane();
|
||||
frame.setGlassPane(glassPane);
|
||||
glassPane.setVisible(false);
|
||||
|
||||
protected abstract boolean hasParaview();
|
||||
customizeGUIFrame(view);
|
||||
}
|
||||
|
||||
protected abstract boolean hasFieldView();
|
||||
public View getView() {
|
||||
return view;
|
||||
}
|
||||
|
||||
protected abstract boolean hasEnsight();
|
||||
public Model getModel() {
|
||||
return model;
|
||||
}
|
||||
|
||||
protected boolean hasSolverPreferences() {
|
||||
return true;
|
||||
}
|
||||
public abstract String getTitle();
|
||||
|
||||
protected boolean isOS() {
|
||||
return false;
|
||||
}
|
||||
protected abstract void customizeGUIFrame(View view);
|
||||
|
||||
protected void addHelpItem(final View view) {
|
||||
view.getMenuBar().getHelpMenu().add(new AbstractAction("About", INFO_ICON) {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
new AboutWindow(getMediumIcon(), getBannerIcon());
|
||||
}
|
||||
});
|
||||
}
|
||||
protected void addPreferencesItem(final View view) {
|
||||
JMenuItem preferencesItem = new JMenuItem(new AbstractAction(PREFERENCES_LABEL, PREFERENCES_ICON) {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (controller.isDemo()) {
|
||||
UiUtil.showDemoMessage();
|
||||
} else {
|
||||
new PreferencesDialog(getPreferencesBean(), model.getDefaults().getDictDataFolder()).show();
|
||||
}
|
||||
}
|
||||
});
|
||||
preferencesItem.setName("Application Preferences");
|
||||
view.getMenuBar().getEditMenu().add(preferencesItem);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public JPanel createAdPanel() {
|
||||
return new JPanel();
|
||||
}
|
||||
protected abstract PreferencesBean getPreferencesBean();
|
||||
|
||||
@Override
|
||||
public JPanel createVersionPanel() {
|
||||
return new JPanel();
|
||||
}
|
||||
|
||||
/**
|
||||
* RESOURCES
|
||||
*/
|
||||
protected void addHelpItem(final View view) {
|
||||
view.getMenuBar().getHelpMenu().add(new AbstractAction("About", INFO_ICON) {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
new AboutWindow(getMediumIcon(), getBannerIcon());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static final Icon PREFERENCES_ICON = ResourcesUtil.getIcon("preferences.icon");
|
||||
public static final Icon LICENSE_ICON = ResourcesUtil.getIcon("license.icon");
|
||||
public static final Icon INFO_ICON = ResourcesUtil.getIcon("info.icon");
|
||||
public static final Icon PDF_ICON = ResourcesUtil.getIcon("file.pdf");
|
||||
public static final Icon FOLDER_ICON = ResourcesUtil.getIcon("application.open.icon");
|
||||
@Override
|
||||
public JPanel createAdPanel() {
|
||||
return new JPanel();
|
||||
}
|
||||
|
||||
public static final Icon SMALL_LOGO = ResourcesUtil.getIcon("engys.logo");
|
||||
public static final Icon BIG_LOGO = ResourcesUtil.getIcon("engys.logo.big");
|
||||
public static final Icon MEDIUM_LOGO = ResourcesUtil.getIcon("engys.logo.medium");
|
||||
public static final Icon FULL_LOGO = ResourcesUtil.getIcon("engys.logo.full");
|
||||
@Override
|
||||
public JPanel createVersionPanel() {
|
||||
return new JPanel();
|
||||
}
|
||||
|
||||
/*
|
||||
* RESOURCES
|
||||
*/
|
||||
|
||||
public static final String PREFERENCES_LABEL = "Preferences";
|
||||
public static final Icon PREFERENCES_ICON = ResourcesUtil.getIcon("preferences.icon");
|
||||
|
||||
public static final String LICENSE_MANAGER_LABEL = "License Manager";
|
||||
public static final Icon LICENSE_MANAGER_ICON = ResourcesUtil.getIcon("license.icon");
|
||||
|
||||
public static final String RELEASE_NOTES_LABEL = "Release Notes";
|
||||
public static final String RELEASE_NOTES_WARNING_MESSAGE = "Release notes not found or not installed";
|
||||
|
||||
public static final String DOCUMENTATION_LABEL = "Documentation";
|
||||
public static final Icon DOCUMENTATION_ICON = ResourcesUtil.getIcon("file.pdf");
|
||||
public static final String DOCUMENTATION_WARNING_MESSAGE = "Documentation not found or not installed";
|
||||
|
||||
public static final Icon INFO_ICON = ResourcesUtil.getIcon("info.icon");
|
||||
public static final Icon FOLDER_ICON = ResourcesUtil.getIcon("application.open.icon");
|
||||
|
||||
public static final Icon SMALL_LOGO = ResourcesUtil.getIcon("engys.logo");
|
||||
public static final Icon BIG_LOGO = ResourcesUtil.getIcon("engys.logo.big");
|
||||
public static final Icon MEDIUM_LOGO = ResourcesUtil.getIcon("engys.logo.medium");
|
||||
public static final Icon FULL_LOGO = ResourcesUtil.getIcon("engys.logo.full");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,28 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.application;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
|
|
|
|||
|
|
@ -1,28 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
|
||||
package eu.engys.application;
|
||||
|
||||
|
|
@ -30,8 +29,12 @@ import javax.swing.Icon;
|
|||
import javax.swing.JFrame;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
public interface Application extends Runnable {
|
||||
import eu.engys.core.Arguments;
|
||||
|
||||
public interface Application {
|
||||
|
||||
public void start(Arguments arguments);
|
||||
|
||||
public JFrame getFrame();
|
||||
public void initFrame();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,28 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
|
||||
package eu.engys.application;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,35 +1,37 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.application;
|
||||
|
||||
import eu.engys.core.Arguments;
|
||||
|
||||
public interface Batch {
|
||||
|
||||
public interface Batch extends Runnable {
|
||||
|
||||
public abstract String getTitle();
|
||||
|
||||
}
|
||||
public abstract void start(Arguments arguments);
|
||||
|
||||
public abstract void checkLicense();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,28 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.application;
|
||||
|
||||
import java.awt.Color;
|
||||
|
|
@ -31,6 +30,7 @@ import java.awt.Font;
|
|||
import java.awt.event.ActionEvent;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.BorderFactory;
|
||||
|
|
@ -46,16 +46,17 @@ import com.google.inject.Inject;
|
|||
|
||||
import eu.engys.core.OpenFOAMEnvironment;
|
||||
import eu.engys.core.controller.Controller;
|
||||
import eu.engys.core.presentation.Action;
|
||||
import eu.engys.core.presentation.ActionManager;
|
||||
import eu.engys.core.modules.ApplicationModule;
|
||||
import eu.engys.core.project.Model;
|
||||
import eu.engys.core.project.zero.patches.BoundaryType;
|
||||
import eu.engys.gui.PreferencesBean;
|
||||
import eu.engys.gui.view.View;
|
||||
import eu.engys.util.ApplicationInfo;
|
||||
import eu.engys.util.Symbols;
|
||||
import eu.engys.util.Util;
|
||||
import eu.engys.util.VersionChecker;
|
||||
import eu.engys.util.VersionChecker.VersionType;
|
||||
import eu.engys.util.ui.ExecUtil;
|
||||
import eu.engys.util.ui.ResourcesUtil;
|
||||
|
||||
public class HELYXOS extends AbstractApplication {
|
||||
|
|
@ -67,9 +68,8 @@ public class HELYXOS extends AbstractApplication {
|
|||
private JButton versionButton;
|
||||
|
||||
@Inject
|
||||
public HELYXOS(Model model, View view, Controller controller) {
|
||||
super(model, view, controller);
|
||||
ActionManager.getInstance().parseActions(this);
|
||||
public HELYXOS(Model model, Set<ApplicationModule> modules, View view, Controller controller) {
|
||||
super(model, modules, view, controller);
|
||||
|
||||
BoundaryType.registerBoundaryType(BoundaryType.PATCH);
|
||||
BoundaryType.registerBoundaryType(BoundaryType.WALL);
|
||||
|
|
@ -107,7 +107,6 @@ public class HELYXOS extends AbstractApplication {
|
|||
});
|
||||
}
|
||||
|
||||
@Action(key = "application.support.window")
|
||||
public void showSupportWindow() {
|
||||
new SupportWindow(getMediumIcon(), getBannerIcon(), DISCLAIMER);
|
||||
}
|
||||
|
|
@ -117,19 +116,23 @@ public class HELYXOS extends AbstractApplication {
|
|||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
VersionType versionType = VersionChecker.isNewVersionAvailable();
|
||||
if (versionType.isUpdated()) {
|
||||
versionLabel.setText("Your version is up to date!");
|
||||
versionLabel.setForeground(Color.GREEN.darker());
|
||||
versionButton.setVisible(false);
|
||||
} else if (versionType.isOld()) {
|
||||
versionLabel.setText("Version " + VersionChecker.getOnlineVersion() + " is available for download!");
|
||||
versionLabel.setForeground(Color.RED);
|
||||
versionButton.setVisible(true);
|
||||
} else if (versionType.isNotAvailable()) {
|
||||
versionLabel.setText("Version not available!");
|
||||
versionButton.setVisible(false);
|
||||
}
|
||||
final VersionType versionType = VersionChecker.isNewVersionAvailable();
|
||||
ExecUtil.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
if (versionType.isUpdated()) {
|
||||
versionLabel.setText("Your version is up to date!");
|
||||
versionLabel.setForeground(Color.GREEN.darker());
|
||||
versionButton.setVisible(false);
|
||||
} else if (versionType.isOld()) {
|
||||
versionLabel.setText("Version " + VersionChecker.getOnlineVersion() + " is available for download!");
|
||||
versionLabel.setForeground(Color.RED);
|
||||
versionButton.setVisible(true);
|
||||
} else if (versionType.isNotAvailable()) {
|
||||
versionLabel.setText("Version not available!");
|
||||
versionButton.setVisible(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
|
@ -162,23 +165,18 @@ public class HELYXOS extends AbstractApplication {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected boolean isOS() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean hasParaview() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean hasFieldView() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean hasEnsight() {
|
||||
return false;
|
||||
protected PreferencesBean getPreferencesBean() {
|
||||
PreferencesBean bean = new PreferencesBean();
|
||||
bean.setPathPreferences(true);
|
||||
bean.setBatchPreferences(false);
|
||||
bean.setVtkPreferences(true);
|
||||
bean.setMiscPreferences(true);
|
||||
bean.setParaview(true);
|
||||
bean.setParaviewBatch(false);
|
||||
bean.setEnsight(false);
|
||||
bean.setFieldview(false);
|
||||
bean.setOS(true);
|
||||
return bean;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -1,28 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
|
||||
package eu.engys.application;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,28 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.application.modules;
|
||||
|
||||
import com.google.inject.AbstractModule;
|
||||
|
|
@ -32,7 +31,6 @@ import com.google.inject.name.Names;
|
|||
|
||||
import eu.engys.application.Application;
|
||||
import eu.engys.application.HELYXOS;
|
||||
import eu.engys.core.Arguments;
|
||||
import eu.engys.core.controller.Controller;
|
||||
import eu.engys.core.controller.HelyxOSController;
|
||||
import eu.engys.core.controller.ScriptFactory;
|
||||
|
|
@ -65,12 +63,13 @@ import eu.engys.gui.casesetup.CaseSetup;
|
|||
import eu.engys.gui.casesetup.CaseSetup3DElement;
|
||||
import eu.engys.gui.casesetup.CaseSetupElement;
|
||||
import eu.engys.gui.casesetup.RuntimeControlsPanel;
|
||||
import eu.engys.gui.casesetup.StandardSolverSettingsPanel;
|
||||
import eu.engys.gui.casesetup.actions.StandardCaseSetupActions;
|
||||
import eu.engys.gui.casesetup.boundaryconditions.BoundaryConditionsPanel;
|
||||
import eu.engys.gui.casesetup.boundaryconditions.panels.CyclicSettingsPanel;
|
||||
import eu.engys.gui.casesetup.boundaryconditions.panels.BoundaryConditionsPanel;
|
||||
import eu.engys.gui.casesetup.boundaryconditions.panels.StandardCyclicAMISettingsPanel;
|
||||
import eu.engys.gui.casesetup.boundaryconditions.panels.patch.PatchSettingsPanel;
|
||||
import eu.engys.gui.casesetup.boundaryconditions.panels.wall.StandardWallSettingsPanel;
|
||||
import eu.engys.gui.casesetup.boundaryconditions.parameterspanel.CyclicSettingsPanel;
|
||||
import eu.engys.gui.casesetup.cellzones.CellZonesPanel;
|
||||
import eu.engys.gui.casesetup.cellzones.StandardCellZonesBuilder;
|
||||
import eu.engys.gui.casesetup.cellzones.mrf.StandardMRF;
|
||||
|
|
@ -89,13 +88,12 @@ import eu.engys.gui.casesetup.materials.panels.MaterialsPanel;
|
|||
import eu.engys.gui.casesetup.run.StandardTable15;
|
||||
import eu.engys.gui.casesetup.schemes.NumericalSchemesPanel;
|
||||
import eu.engys.gui.casesetup.solution.StandardSolutionModellingPanel;
|
||||
import eu.engys.gui.casesetup.solver.SolverSettingsPanel;
|
||||
import eu.engys.gui.custom.CustomNodePanel;
|
||||
import eu.engys.gui.mesh.Mesh;
|
||||
import eu.engys.gui.mesh.Mesh3DElement;
|
||||
import eu.engys.gui.mesh.MeshElement;
|
||||
import eu.engys.gui.mesh.StandardBoundaryMeshPanel;
|
||||
import eu.engys.gui.mesh.actions.StandardMeshActions;
|
||||
import eu.engys.gui.mesh.panels.DefaultBoundaryMeshPanel;
|
||||
import eu.engys.gui.mesh.panels.DefaultMeshAdvancedOptionsPanel;
|
||||
import eu.engys.gui.mesh.panels.MaterialPointsPanel;
|
||||
import eu.engys.gui.mesh.panels.SolverBoundaryMeshPanel;
|
||||
|
|
@ -113,26 +111,18 @@ import eu.engys.gui.solver.postprocessing.panels.residuals.ResidualsPanel;
|
|||
import eu.engys.gui.view.View;
|
||||
import eu.engys.gui.view.View3DElement;
|
||||
import eu.engys.gui.view.ViewElement;
|
||||
import eu.engys.gui.view3D.CanvasPanel;
|
||||
import eu.engys.gui.view3D.Controller3D;
|
||||
import eu.engys.gui.view3D.Geometry3DController;
|
||||
import eu.engys.gui.view3D.Mesh3DController;
|
||||
import eu.engys.gui.view3D.fallback.FallbackGeometry3DController;
|
||||
import eu.engys.gui.view3D.fallback.FallbackMesh3DController;
|
||||
import eu.engys.gui.view3D.fallback.FallbackView3D;
|
||||
import eu.engys.gui.view3D.widget.Widget;
|
||||
import eu.engys.launcher.ApplicationLauncher;
|
||||
import eu.engys.launcher.HELYXOSLauncher;
|
||||
import eu.engys.standardDynamic.StandardDynamicModule;
|
||||
import eu.engys.standardVOF.StandardVOFModule;
|
||||
import eu.engys.util.VTKSettings;
|
||||
import eu.engys.util.plaf.HelyxOSLookAndFeel;
|
||||
import eu.engys.util.plaf.ILookAndFeel;
|
||||
import eu.engys.util.progress.ProgressMonitor;
|
||||
import eu.engys.util.progress.ProgressMonitorImpl;
|
||||
import eu.engys.vtk.VTKEmptyView3D;
|
||||
import eu.engys.vtk.VTKGeometry3DController;
|
||||
import eu.engys.vtk.VTKMesh3DController;
|
||||
import eu.engys.vtk.VTKView3D;
|
||||
import eu.engys.vtk.WidgetPanel;
|
||||
|
||||
public class HELYXOSModule extends AbstractModule {
|
||||
|
|
@ -184,27 +174,11 @@ public class HELYXOSModule extends AbstractModule {
|
|||
private void configureModules() {
|
||||
Multibinder<ApplicationModule> applicationModules = Multibinder.newSetBinder(binder(), ApplicationModule.class);
|
||||
applicationModules.addBinding().to(StandardVOFModule.class).in(Singleton.class);
|
||||
applicationModules.addBinding().to(StandardDynamicModule.class).in(Singleton.class);
|
||||
}
|
||||
|
||||
protected void configure3D() {
|
||||
bind(WidgetPanel.class).in(Singleton.class);
|
||||
if (!VTKSettings.librariesAreLoaded()) {
|
||||
VTKSettings.LoadAllNativeLibraries();
|
||||
}
|
||||
if (VTKSettings.librariesAreLoaded()) {
|
||||
if (Arguments.no3D) {
|
||||
bind(CanvasPanel.class).to(VTKEmptyView3D.class).in(Singleton.class);
|
||||
} else {
|
||||
bind(CanvasPanel.class).to(VTKView3D.class).in(Singleton.class);
|
||||
}
|
||||
bind(Geometry3DController.class).to(VTKGeometry3DController.class).in(Singleton.class);
|
||||
bind(Mesh3DController.class).to(VTKMesh3DController.class).in(Singleton.class);
|
||||
} else {
|
||||
bind(CanvasPanel.class).to(FallbackView3D.class).in(Singleton.class);
|
||||
bind(Geometry3DController.class).to(FallbackGeometry3DController.class).in(Singleton.class);
|
||||
bind(Mesh3DController.class).to(FallbackMesh3DController.class).in(Singleton.class);
|
||||
}
|
||||
|
||||
Multibinder<Controller3D> controllers = Multibinder.newSetBinder(binder(), Controller3D.class);
|
||||
controllers.addBinding().to(Geometry3DController.class).in(Singleton.class);
|
||||
controllers.addBinding().to(Mesh3DController.class).in(Singleton.class);
|
||||
|
|
@ -242,7 +216,7 @@ public class HELYXOSModule extends AbstractModule {
|
|||
panelsMesh.addBinding().to(StandardGeometryPanel.class).in(Singleton.class);
|
||||
panelsMesh.addBinding().to(StandardFeatureLinesPanel.class).in(Singleton.class);
|
||||
panelsMesh.addBinding().to(MaterialPointsPanel.class).in(Singleton.class);
|
||||
panelsMesh.addBinding().to(DefaultBoundaryMeshPanel.class).in(Singleton.class);
|
||||
panelsMesh.addBinding().to(StandardBoundaryMeshPanel.class).in(Singleton.class);
|
||||
panelsMesh.addBinding().to(CustomNodePanel.class).in(Singleton.class);
|
||||
|
||||
Multibinder<GUIPanel> panelsCaseSetup = Multibinder.newSetBinder(binder(), GUIPanel.class, CaseSetup.class);
|
||||
|
|
@ -250,8 +224,9 @@ public class HELYXOSModule extends AbstractModule {
|
|||
panelsCaseSetup.addBinding().to(MaterialsPanel.class).in(Singleton.class);
|
||||
panelsCaseSetup.addBinding().to(BoundaryConditionsPanel.class).in(Singleton.class);
|
||||
panelsCaseSetup.addBinding().to(CellZonesPanel.class).in(Singleton.class);
|
||||
// panelsCaseSetup.addBinding().to(FaceZonesPanel.class).in(Singleton.class);
|
||||
panelsCaseSetup.addBinding().to(NumericalSchemesPanel.class).in(Singleton.class);
|
||||
panelsCaseSetup.addBinding().to(SolverSettingsPanel.class).in(Singleton.class);
|
||||
panelsCaseSetup.addBinding().to(StandardSolverSettingsPanel.class).in(Singleton.class);
|
||||
panelsCaseSetup.addBinding().to(RuntimeControlsPanel.class).in(Singleton.class);
|
||||
panelsCaseSetup.addBinding().to(StandardFieldsInitialisationPanel.class).in(Singleton.class);
|
||||
panelsCaseSetup.addBinding().to(CustomNodePanel.class).in(Singleton.class);
|
||||
|
|
|
|||
|
|
@ -1,33 +1,33 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FilenameFilter;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
import org.apache.log4j.Level;
|
||||
|
||||
|
|
@ -36,197 +36,237 @@ import eu.engys.util.Util;
|
|||
|
||||
public class Arguments {
|
||||
|
||||
private static final String LINE = " ********************************";
|
||||
private static final String TAB = " ";
|
||||
private static final String LINE = " ********************************";
|
||||
private static final String TAB = " ";
|
||||
|
||||
public enum CaseType {
|
||||
SERIAL, PARALLEL
|
||||
}
|
||||
public boolean verbose = false;
|
||||
public boolean no3D = false;
|
||||
public boolean load3Dmesh = true;
|
||||
public boolean load3Dgeometry = true;
|
||||
public Level logLevel = Level.ERROR;
|
||||
|
||||
public static boolean verbose = false;
|
||||
public static boolean no3D = false;
|
||||
public static boolean load3Dmesh = true;
|
||||
public static boolean load3Dgeometry = true;
|
||||
public static Level logLevel = Level.ERROR;
|
||||
public File baseDir = null;
|
||||
public File studyDir = null;
|
||||
|
||||
public static File baseDir = null;
|
||||
public boolean mesh = false;
|
||||
public boolean run = false;
|
||||
public boolean setup = false;
|
||||
public boolean all = false;
|
||||
public boolean initialise = false;
|
||||
public boolean post = false;
|
||||
|
||||
public static boolean mesh = false;
|
||||
public static boolean run = false;
|
||||
public static boolean setup = false;
|
||||
public static boolean all = false;
|
||||
public static boolean initialise = false;
|
||||
public int concurrentDesigns = 1;
|
||||
|
||||
public static boolean server = false;
|
||||
public static CaseType caseType = null;
|
||||
public static File[] stlFiles = null;
|
||||
// public static long timeout = -1L;
|
||||
public boolean server = false;
|
||||
public File[] importFiles = null;
|
||||
|
||||
private static final String OPTION_V = "-v";
|
||||
private static final String OPTION_VV = "-V";
|
||||
private static final String OPTION_HELP = "-help";
|
||||
private static final String OPTION_NO3D = "-no3D";
|
||||
private static final String OPTION_CASE = "-case";
|
||||
|
||||
public static final String OPTION_MESH = "-mesh";
|
||||
public static final String OPTION_RUN = "-run";
|
||||
public static final String OPTION_SETUP = "-setup";
|
||||
public static final String OPTION_ALL = "-all";
|
||||
public static final String OPTION_INITIALISE = "-initialise";
|
||||
private static final String OPTION_V = "-v";
|
||||
private static final String OPTION_VV = "-V";
|
||||
private static final String OPTION_HELP = "-help";
|
||||
private static final String OPTION_NO3D = "-no3D";
|
||||
private static final String OPTION_CASE = "-case";
|
||||
private static final String OPTION_STUDY = "-study";
|
||||
|
||||
private static final String OPTION_SERVER = "-server"; /* INTERNAL */
|
||||
private static final String OPTION_IMPORT = "-import"; /* INTERNAL */
|
||||
private static final String OPTION_NOMESH = "-no3Dmesh"; /* INTERNAL */
|
||||
private static final String OPTION_NOGEOM = "-no3DGeom"; /* INTERNAL */
|
||||
// private static final String OPTION_CORE = "-core"; /* INTERNAL */
|
||||
// private static final String OPTION_TIMEOUT = "-timeout"; /* INTERNAL */
|
||||
public static final String OPTION_MESH = "-mesh";
|
||||
public static final String OPTION_RUN = "-run";
|
||||
public static final String OPTION_SETUP = "-setup";
|
||||
public static final String OPTION_ALL = "-all";
|
||||
public static final String OPTION_INITIALISE = "-initialise";
|
||||
public static final String OPTION_POST = "-post";
|
||||
public static final String OPTION_MEMORY = "-memory=<size>";
|
||||
|
||||
public static void init(final String[] argv) {
|
||||
for (int i = 0; i < argv.length; i++) {
|
||||
final String arg = argv[i];
|
||||
public static final String OPTION_CONCURRENT_DESIGNS = "-concurrent";
|
||||
|
||||
if (arg.charAt(0) == '-') {
|
||||
switch (arg) {
|
||||
private static final String OPTION_SERVER = "-server"; /* INTERNAL */
|
||||
private static final String OPTION_IMPORT = "-import"; /* INTERNAL */
|
||||
private static final String OPTION_NOMESH = "-no3Dmesh"; /* INTERNAL */
|
||||
private static final String OPTION_NOGEOM = "-no3DGeom"; /* INTERNAL */
|
||||
|
||||
// private static final String OPTION_CORE = "-core"; /* INTERNAL */
|
||||
// private static final String OPTION_TIMEOUT = "-timeout"; /* INTERNAL */
|
||||
|
||||
public void parse(final String[] argv) {
|
||||
for (int i = 0; i < argv.length; i++) {
|
||||
final String arg = argv[i];
|
||||
|
||||
if (arg.charAt(0) == '-') {
|
||||
switch (arg) {
|
||||
case OPTION_V: logLevel = Level.INFO; verbose = true; break;
|
||||
case OPTION_VV: logLevel = Level.DEBUG; verbose = true; break;
|
||||
case OPTION_NO3D: no3D = true; break;
|
||||
|
||||
case OPTION_CASE:
|
||||
if (i == argv.length - 1) {
|
||||
fatal("Missing case folder");
|
||||
printUsage();
|
||||
exit(-1);
|
||||
}
|
||||
String baseDirPath = argv[++i];
|
||||
final File baseDir = new File(baseDirPath);
|
||||
if (!baseDir.exists()) {
|
||||
warning("Case Folder \"" + baseDir.getAbsolutePath() + "\" Does Not Exist!");
|
||||
} else {
|
||||
Arguments.baseDir = baseDir;
|
||||
}
|
||||
break;
|
||||
|
||||
case OPTION_MESH: mesh = true; break;
|
||||
case OPTION_RUN: run = true; break;
|
||||
case OPTION_SETUP: setup = true; break;
|
||||
case OPTION_ALL: all = true; break;
|
||||
case OPTION_INITIALISE: initialise = true; break;
|
||||
case OPTION_SERVER: server = true; break;
|
||||
|
||||
|
||||
case OPTION_CASE:
|
||||
if (i == argv.length - 1) {
|
||||
fatal("Missing case folder");
|
||||
printUsage();
|
||||
exit(-1);
|
||||
}
|
||||
String baseDirPath = argv[++i];
|
||||
try {
|
||||
/*
|
||||
* Use toRealPath to avoid bad path display when using "." and ".."
|
||||
*/
|
||||
File baseDir = Paths.get(baseDirPath).toRealPath().toFile();
|
||||
if (!baseDir.exists()) {
|
||||
warning("Case Folder \"" + baseDir.getAbsolutePath() + "\" Does Not Exist!");
|
||||
} else {
|
||||
this.baseDir = baseDir;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
warning(e.getMessage());
|
||||
}
|
||||
|
||||
break;
|
||||
case OPTION_STUDY:
|
||||
if (i == argv.length - 1) {
|
||||
fatal("Missing study folder");
|
||||
printUsage();
|
||||
exit(-1);
|
||||
}
|
||||
String studyDirPath = argv[++i];
|
||||
final File studyDir = new File(studyDirPath);
|
||||
if (!studyDir.exists()) {
|
||||
warning("Case Folder \"" + studyDir.getAbsolutePath() + "\" Does Not Exist!");
|
||||
} else {
|
||||
this.studyDir = studyDir;
|
||||
}
|
||||
break;
|
||||
|
||||
case OPTION_MESH: this.mesh = true; break;
|
||||
case OPTION_RUN: this.run = true; break;
|
||||
case OPTION_SETUP: this.setup = true; break;
|
||||
case OPTION_ALL: this.all = true; break;
|
||||
case OPTION_INITIALISE: this.initialise = true; break;
|
||||
case OPTION_POST: this.post = true; break;
|
||||
case OPTION_SERVER: this.server = true; break;
|
||||
|
||||
case OPTION_CONCURRENT_DESIGNS:
|
||||
if (i == argv.length - 1) {
|
||||
fatal("Missing number of concurrent designs folder");
|
||||
printUsage();
|
||||
exit(-1);
|
||||
}
|
||||
String designs = argv[++i];
|
||||
try {
|
||||
int nDesigns = Integer.parseInt(designs);
|
||||
this.concurrentDesigns = nDesigns;
|
||||
} catch (NumberFormatException nfe) {
|
||||
warning("Invalid number of concurrent designs");
|
||||
}
|
||||
break;
|
||||
case OPTION_NOGEOM: load3Dgeometry = false; break;
|
||||
case OPTION_NOMESH: load3Dmesh = false; break;
|
||||
|
||||
case OPTION_IMPORT:
|
||||
if (i == argv.length - 1) {
|
||||
fatal("Missing import folder");
|
||||
printUsage();
|
||||
exit(-1);
|
||||
}
|
||||
String importPath = argv[++i];
|
||||
final File importFolder = new File(importPath);
|
||||
if (!importFolder.exists()) {
|
||||
fatal("Import Folder Does Not Exist!");
|
||||
exit(-1);
|
||||
} else if (importFolder.isFile()) {
|
||||
String name = importFolder.getName();
|
||||
if (name.endsWith("stl") || name.endsWith("STL")) {
|
||||
Arguments.stlFiles = new File[]{importFolder};
|
||||
} else {
|
||||
fatal("Import Folder Does Not Exist!");
|
||||
exit(-1);
|
||||
}
|
||||
} else {
|
||||
File[] stls = importFolder.listFiles(new FilenameFilter() {
|
||||
@Override
|
||||
public boolean accept(File dir, String name) {
|
||||
return name.endsWith("stl") || name.endsWith("STL");
|
||||
}
|
||||
});
|
||||
if (stls.length == 0) {
|
||||
fatal("No files to import!");
|
||||
exit(-1);
|
||||
} else {
|
||||
Arguments.stlFiles = stls;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case OPTION_HELP:
|
||||
printUsage();
|
||||
exit(0);
|
||||
break;
|
||||
default:
|
||||
fatal("Unknown Option " + arg);
|
||||
printUsage();
|
||||
exit(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
checkCase();
|
||||
}
|
||||
|
||||
private static void checkCase() {
|
||||
if (hasCommand()) {
|
||||
if (Arguments.baseDir == null) {
|
||||
fatal("Missing case folder");
|
||||
printUsage();
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
case OPTION_IMPORT:
|
||||
if (i == argv.length - 1) {
|
||||
fatal("Missing import file/folder");
|
||||
printUsage();
|
||||
exit(-1);
|
||||
}
|
||||
String importPath = argv[++i];
|
||||
final File importFolder = new File(importPath);
|
||||
if (!importFolder.exists()) {
|
||||
fatal("Import Folder Does Not Exist!");
|
||||
exit(-1);
|
||||
} else if (importFolder.isFile()) {
|
||||
this.importFiles = new File[] { importFolder };
|
||||
} else {
|
||||
File[] stls = importFolder.listFiles(new FilenameFilter() {
|
||||
@Override
|
||||
public boolean accept(File dir, String name) {
|
||||
return name.endsWith("stl") || name.endsWith("STL");
|
||||
}
|
||||
});
|
||||
if (stls.length == 0) {
|
||||
fatal("No files to import!");
|
||||
exit(-1);
|
||||
} else {
|
||||
this.importFiles = stls;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case OPTION_HELP:
|
||||
printUsage();
|
||||
exit(0);
|
||||
break;
|
||||
default:
|
||||
fatal("Unknown Option " + arg);
|
||||
printUsage();
|
||||
exit(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
checkCaseOrStudy();
|
||||
}
|
||||
|
||||
private static void fatal(String msg) {
|
||||
System.err.println();
|
||||
System.err.println(LINE);
|
||||
System.err.println(" " + TAB + "FATAL ERROR:");
|
||||
System.err.println(" " + TAB + TAB + msg);
|
||||
System.err.println(LINE);
|
||||
}
|
||||
private void checkCaseOrStudy() {
|
||||
if (hasCommand()) {
|
||||
if (baseDir == null && studyDir == null) {
|
||||
fatal("Missing case (or study) folder");
|
||||
printUsage();
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void warning(String msg) {
|
||||
System.err.println();
|
||||
System.err.println(LINE);
|
||||
System.err.println(" " + TAB+"WARNING:");
|
||||
System.err.println(" " + TAB + TAB + msg);
|
||||
System.err.println(TAB+LINE);
|
||||
}
|
||||
|
||||
private static void exit(int status) {
|
||||
System.exit(status);
|
||||
}
|
||||
private static void fatal(String msg) {
|
||||
System.err.println();
|
||||
System.err.println(LINE);
|
||||
System.err.println(" " + TAB + "FATAL ERROR:");
|
||||
System.err.println(" " + TAB + TAB + msg);
|
||||
System.err.println(LINE);
|
||||
}
|
||||
|
||||
private static void printUsage() {
|
||||
|
||||
System.err.println(" USAGE");
|
||||
System.err.println(" -----------------------------------------------------");
|
||||
if (Util.isWindows())
|
||||
System.err.println(" "+ApplicationInfo.getName()+".bat ["+OPTION_V+"] ["+OPTION_VV+"] [-case <folder>] [command] ");
|
||||
else
|
||||
System.err.println(" "+ApplicationInfo.getName()+".sh ["+OPTION_V+"] ["+OPTION_VV+"] [-case <folder>] [command] ");
|
||||
|
||||
System.err.println();
|
||||
System.err.println(" Options:");
|
||||
System.err.println(" " + Util.padWithSpaces(OPTION_HELP, 12) + " Print this help screen.");
|
||||
System.err.println(" " + Util.padWithSpaces(OPTION_V, 12) + " The verbose output.");
|
||||
System.err.println(" " + Util.padWithSpaces(OPTION_VV, 12) + " The very verbose output.");
|
||||
System.err.println(" " + Util.padWithSpaces(OPTION_CASE, 12) + " <folder> Specify the case directory for the application.");
|
||||
System.err.println(" " + Util.padWithSpaces(OPTION_NO3D, 12) + " Does not display 3D window.");
|
||||
System.err.println();
|
||||
System.err.println(" Commands:");
|
||||
System.err.println(" " + Util.padWithSpaces(OPTION_MESH, 12) + " Launch mesh creation according to system/snappyHexMeshDict.");
|
||||
System.err.println(" " + Util.padWithSpaces(OPTION_SETUP, 12) + " Setup the cfd case according to system/caseSetupDict.");
|
||||
System.err.println(" " + Util.padWithSpaces(OPTION_INITIALISE, 12) + " Initialise the fields according to system/caseSetupDict.");
|
||||
System.err.println(" " + Util.padWithSpaces(OPTION_RUN, 12) + " Launch the solver.");
|
||||
System.err.println(" " + Util.padWithSpaces(OPTION_ALL, 12) + " Launch mesh + setup + run.");
|
||||
System.err.println(" -----------------------------------------------------");
|
||||
}
|
||||
private static void warning(String msg) {
|
||||
System.err.println();
|
||||
System.err.println(LINE);
|
||||
System.err.println(" " + TAB + "WARNING:");
|
||||
System.err.println(" " + TAB + TAB + msg);
|
||||
System.err.println(TAB + LINE);
|
||||
}
|
||||
|
||||
public static boolean isBatch() {
|
||||
return Arguments.server || hasCommand();
|
||||
}
|
||||
private static void exit(int status) {
|
||||
System.exit(status);
|
||||
}
|
||||
|
||||
private static boolean hasCommand() {
|
||||
return Arguments.mesh || Arguments.setup || Arguments.run || Arguments.all || Arguments.initialise;
|
||||
}
|
||||
private static void printUsage() {
|
||||
|
||||
System.err.println(" USAGE");
|
||||
System.err.println(" -----------------------------------------------------");
|
||||
if (Util.isWindows())
|
||||
System.err.println(" " + ApplicationInfo.getName() + ".bat [" + OPTION_V + "] [" + OPTION_VV + "] [-case <folder>] [command] ");
|
||||
else
|
||||
System.err.println(" " + ApplicationInfo.getName() + ".sh [" + OPTION_V + "] [" + OPTION_VV + "] [-case <folder>] [command] ");
|
||||
|
||||
System.err.println();
|
||||
System.err.println(" Options:");
|
||||
System.err.println(" " + Util.padWithSpaces(OPTION_HELP, 12) + " Print this help screen.");
|
||||
System.err.println(" " + Util.padWithSpaces(OPTION_V, 12) + " The verbose output.");
|
||||
System.err.println(" " + Util.padWithSpaces(OPTION_VV, 12) + " The very verbose output.");
|
||||
System.err.println(" " + Util.padWithSpaces(OPTION_NO3D, 12) + " Does not display 3D window.");
|
||||
System.err.println(" " + Util.padWithSpaces(OPTION_CASE, 12) + " Specify the case directory for the application.");
|
||||
System.err.println(" " + Util.padWithSpaces(OPTION_STUDY, 12) + " Specify the study directory for the application (case manager only).");
|
||||
System.err.println(" " + Util.padWithSpaces(OPTION_CONCURRENT_DESIGNS, 12) + " Specify the number of cases to run in parallel (case manager only).");
|
||||
System.err.println();
|
||||
System.err.println(" " + Util.padWithSpaces(OPTION_MEMORY, 12) + " Set the maximum memory size. Size is expressed as '1234m' or '1g' ");
|
||||
System.err.println();
|
||||
System.err.println(" Commands:");
|
||||
System.err.println(" " + Util.padWithSpaces(OPTION_MESH, 12) + " Launch mesh creation according to system/snappyHexMeshDict.");
|
||||
System.err.println(" " + Util.padWithSpaces(OPTION_SETUP, 12) + " Setup the cfd case according to system/caseSetupDict.");
|
||||
System.err.println(" " + Util.padWithSpaces(OPTION_INITIALISE, 12) + " Initialise the fields according to system/caseSetupDict.");
|
||||
System.err.println(" " + Util.padWithSpaces(OPTION_RUN, 12) + " Launch the solver.");
|
||||
System.err.println(" " + Util.padWithSpaces(OPTION_ALL, 12) + " Launch mesh + setup + run.");
|
||||
System.err.println(" " + Util.padWithSpaces(OPTION_POST, 12) + " Extract post-processing results.");
|
||||
System.err.println(" -----------------------------------------------------");
|
||||
}
|
||||
|
||||
public boolean isBatch() {
|
||||
return server || hasCommand();
|
||||
}
|
||||
|
||||
private boolean hasCommand() {
|
||||
return mesh || setup || run || all || initialise || post;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
239
src/eu/engys/core/DockerUtil.java
Normal file
239
src/eu/engys/core/DockerUtil.java
Normal file
|
|
@ -0,0 +1,239 @@
|
|||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core;
|
||||
|
||||
import static eu.engys.util.OpenFOAMCommands.PARA_FOAM;
|
||||
import static eu.engys.util.PrefUtil.DOCKER_IMAGE;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.exec.CommandLine;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import eu.engys.util.PrefUtil;
|
||||
import eu.engys.util.Util;
|
||||
|
||||
public class DockerUtil {
|
||||
|
||||
private static final String USER = PrefUtil.USER_NAME;
|
||||
private static final String HOME = PrefUtil.USER_HOME;
|
||||
private static final String USER_UID = Util.getUID();
|
||||
private static final String DISPLAY = PrefUtil.DISPLAY;
|
||||
private static final String SHARE = "/share";
|
||||
|
||||
private static final String ENGYS_22_BETA_VENDOR_HOME = "/opt";
|
||||
private static final String ENGYS_22_BETA_ENV_LOADER = "/opt/OpenFOAM-2.2_engysEdition-beta/etc/bashrc";
|
||||
|
||||
private static final String OF_PLUS_VENDOR_HOME = "/opt/OpenFOAM";
|
||||
private static final String OF_PLUS_ENV_LOADER = "/opt/OpenFOAM/OpenFOAM-v1606+/etc/bashrc";
|
||||
|
||||
private static final String PV_VERSION = "4.1.0";
|
||||
private static final String MACHINEFILE = "";
|
||||
|
||||
private static final String WINDOWS_DOCKER_ENV = "FOR /f \"tokens=*\" %%i IN ('\"C:\\Program Files\\Docker Toolbox\\docker-machine\" env default --shell=cmd') DO %%i";
|
||||
|
||||
public static CommandLine getCommandLine(Map<String, String> environment, String script) {
|
||||
String dockerImage = PrefUtil.getString(DOCKER_IMAGE);
|
||||
|
||||
String casePath = ensureLinuxPath(environment.get("CASE"));
|
||||
String scriptPath = ensureLinuxPath(casePath + "/" + script);
|
||||
|
||||
List<String> arguments = new LinkedList<>();
|
||||
|
||||
addRunCommand(arguments, false, false);
|
||||
addScriptVariables(arguments, environment);
|
||||
addDisplayVariables(arguments);
|
||||
addUserVariables(arguments);
|
||||
addWorkDir(arguments, Util.isWindows() ? SHARE : HOME);
|
||||
|
||||
arguments.add(dockerImage);
|
||||
|
||||
// the actual command
|
||||
arguments.add(scriptPath);
|
||||
|
||||
CommandLine commandLine = new CommandLine("docker");
|
||||
commandLine.addArguments(arguments.toArray(new String[0]), false);
|
||||
return Util.isWindows() ? windowsWrapper(environment.get("CASE"), commandLine) : commandLine;
|
||||
}
|
||||
|
||||
public static String terminal(File baseDir) {
|
||||
String dockerImage = PrefUtil.getString(DOCKER_IMAGE);
|
||||
boolean isOFPlus = dockerImage.contains("openfoamplus");
|
||||
|
||||
String ENV_LOADER = isOFPlus ? OF_PLUS_ENV_LOADER : ENGYS_22_BETA_ENV_LOADER;
|
||||
|
||||
List<String> arguments = new LinkedList<>();
|
||||
|
||||
addRunCommand(arguments, true, true);
|
||||
addDisplayVariables(arguments);
|
||||
addUserVariables(arguments);
|
||||
addWorkDir(arguments, baseDir.getAbsolutePath());
|
||||
|
||||
arguments.add(dockerImage);
|
||||
|
||||
// the actual command
|
||||
arguments.add("/bin/bash");
|
||||
arguments.add("--rcfile");
|
||||
arguments.add(ENV_LOADER);
|
||||
|
||||
CommandLine commandLine = new CommandLine("docker");
|
||||
commandLine.addArguments(arguments.toArray(new String[0]), false);
|
||||
return Util.isWindows() ? windowsWrapper(baseDir.getAbsolutePath(), commandLine).toString() : commandLine.toString();
|
||||
}
|
||||
|
||||
public static String paraview(File baseDir) {
|
||||
String dockerImage = PrefUtil.getString(DOCKER_IMAGE);
|
||||
boolean isOFPlus = dockerImage.contains("openfoamplus");
|
||||
|
||||
String ENV_LOADER = isOFPlus ? OF_PLUS_ENV_LOADER : ENGYS_22_BETA_ENV_LOADER;
|
||||
|
||||
List<String> arguments = new LinkedList<>();
|
||||
|
||||
addRunCommand(arguments, true, false);
|
||||
addDisplayVariables(arguments);
|
||||
addUserVariables(arguments);
|
||||
addWorkDir(arguments, baseDir.getAbsolutePath());
|
||||
|
||||
arguments.add(dockerImage);
|
||||
|
||||
// the actual command
|
||||
arguments.add("/bin/bash");
|
||||
arguments.add("--rcfile");
|
||||
arguments.add(ENV_LOADER);
|
||||
arguments.add("-ci");
|
||||
arguments.add(PARA_FOAM);
|
||||
|
||||
CommandLine commandLine = new CommandLine("docker");
|
||||
commandLine.addArguments(arguments.toArray(new String[0]), false);
|
||||
return Util.isWindows() ? windowsWrapper(baseDir.getAbsolutePath(), commandLine).toString() : commandLine.toString();
|
||||
}
|
||||
|
||||
/*
|
||||
* Utils
|
||||
*/
|
||||
private static String ensureLinuxPath(String winPath) {
|
||||
if (Util.isWindows()) {
|
||||
String linuxPath = winPath;
|
||||
linuxPath = linuxPath.replace(HOME, SHARE);
|
||||
if (linuxPath.endsWith("bat")) {
|
||||
linuxPath = linuxPath.replace("bat", "run");
|
||||
}
|
||||
return linuxPath.replace("\\", "/");
|
||||
} else {
|
||||
return winPath;
|
||||
}
|
||||
}
|
||||
|
||||
private static void addWorkDir(List<String> arguments, String workDir) {
|
||||
arguments.add("-w");
|
||||
arguments.add(ensureLinuxPath(workDir));
|
||||
}
|
||||
|
||||
private static void addScriptVariables(List<String> arguments, Map<String, String> environment) {
|
||||
String dockerImage = PrefUtil.getString(DOCKER_IMAGE);
|
||||
boolean isOFPlus = dockerImage.contains("openfoamplus");
|
||||
|
||||
String NP = environment.get("NP");
|
||||
String SOLVER = environment.get("SOLVER");
|
||||
|
||||
String VENDOR_HOME = isOFPlus ? OF_PLUS_VENDOR_HOME : ENGYS_22_BETA_VENDOR_HOME;
|
||||
String ENV_LOADER = isOFPlus ? OF_PLUS_ENV_LOADER : ENGYS_22_BETA_ENV_LOADER;
|
||||
|
||||
String CASE = ensureLinuxPath(environment.get("CASE"));
|
||||
String LOG = ensureLinuxPath(environment.get("LOG"));
|
||||
|
||||
arguments.add("-e");
|
||||
arguments.add("CASE=" + CASE);
|
||||
arguments.add("-e");
|
||||
arguments.add("NP=" + NP);
|
||||
arguments.add("-e");
|
||||
arguments.add("LOG=" + LOG);
|
||||
arguments.add("-e");
|
||||
arguments.add("ENV_LOADER=" + ENV_LOADER);
|
||||
arguments.add("-e");
|
||||
arguments.add("VENDOR_HOME=" + VENDOR_HOME);
|
||||
arguments.add("-e");
|
||||
arguments.add("SOLVER=" + SOLVER);
|
||||
arguments.add("-e");
|
||||
arguments.add("PV_VERSION=" + PV_VERSION);
|
||||
arguments.add("-e");
|
||||
arguments.add("MACHINEFILE=" + MACHINEFILE);
|
||||
}
|
||||
|
||||
private static void addDisplayVariables(List<String> arguments) {
|
||||
arguments.add("-e");
|
||||
arguments.add("QT_X11_NO_MITSHM=1");
|
||||
arguments.add("-e");
|
||||
arguments.add("DISPLAY=" + DISPLAY);
|
||||
}
|
||||
|
||||
private static void addUserVariables(List<String> arguments) {
|
||||
arguments.add("-e");
|
||||
arguments.add("USER=" + USER);
|
||||
arguments.add("-v");
|
||||
arguments.add(Util.isWindows() ? (SHARE + ":" + SHARE) : (HOME + ":" + HOME));
|
||||
arguments.add("-v");
|
||||
arguments.add("/etc/group:/etc/group:ro");
|
||||
arguments.add("-v");
|
||||
arguments.add("/etc/passwd:/etc/passwd:ro");
|
||||
arguments.add("-v");
|
||||
arguments.add("/etc/shadow:/etc/shadow:ro");
|
||||
arguments.add("-v");
|
||||
arguments.add("/etc/sudoers.d:/etc");
|
||||
arguments.add("-v");
|
||||
arguments.add("/tmp:/tmp");
|
||||
}
|
||||
|
||||
private static void addRunCommand(List<String> arguments, boolean interactive, boolean tty) {
|
||||
arguments.add("run");
|
||||
arguments.add("--rm");
|
||||
if (interactive && tty) {
|
||||
arguments.add("-it");
|
||||
} else if (interactive) {
|
||||
arguments.add("-i");
|
||||
}
|
||||
arguments.add("-u");
|
||||
arguments.add(USER_UID);
|
||||
}
|
||||
|
||||
private static CommandLine windowsWrapper(String baseDir, CommandLine commandLine) {
|
||||
File f = new File(baseDir, "dockerWrapper.bat");
|
||||
List<String> lines = new LinkedList<>();
|
||||
lines.add("@echo off");
|
||||
lines.add(WINDOWS_DOCKER_ENV);
|
||||
lines.add(commandLine.toString());
|
||||
try {
|
||||
FileUtils.writeLines(f, lines, false);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return new CommandLine(f.getAbsolutePath());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,28 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core;
|
||||
|
||||
import static eu.engys.core.project.openFOAMProject.LOG;
|
||||
|
|
@ -38,6 +37,7 @@ import java.util.Map;
|
|||
import javax.swing.JFrame;
|
||||
|
||||
import org.apache.commons.exec.CommandLine;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
|
@ -106,10 +106,6 @@ public class OpenFOAMEnvironment {
|
|||
return getEnvironment(model, "");
|
||||
}
|
||||
|
||||
// public static Map<String, String> getEnvironment(Model model, File baseDir) {
|
||||
// return getEnvironment(model, baseDir, null, null);
|
||||
// }
|
||||
|
||||
public static Map<String, String> getEnvironment(Model model, String logFileName) {
|
||||
return getEnvironment(model, model.getProject().getBaseDir(), logFileName, null);
|
||||
}
|
||||
|
|
@ -137,11 +133,11 @@ public class OpenFOAMEnvironment {
|
|||
map.put("LOG", Paths.get(model.getProject().getBaseDir().getAbsolutePath(), LOG, logFileName).toString());
|
||||
}
|
||||
|
||||
map.put("VENDOR_HOME", getVendorHome().getAbsolutePath());
|
||||
map.put("VENDOR_HOME", getVendorHome() != null ? getVendorHome().getAbsolutePath() : "");
|
||||
|
||||
map.put("PV_VERSION", getParaviewVersion());
|
||||
|
||||
map.put("ENV_LOADER", getEnvLoader().getAbsolutePath());
|
||||
map.put("ENV_LOADER", getEnvLoader() != null ? getEnvLoader().getAbsolutePath() : "");
|
||||
|
||||
if (option != null) {
|
||||
JavaExecutor executor = Executor.jvm("eu.engys.launcher.Launcher", option, "-V");
|
||||
|
|
@ -219,6 +215,8 @@ public class OpenFOAMEnvironment {
|
|||
} else {
|
||||
UiUtil.showCoreEnvironmentNotLoadedWarning(frame);
|
||||
}
|
||||
} else {
|
||||
logger.info("Environment set to {}. Version {} ({})", PrefUtil.getOpenFoamEntry(), getOpenFoamVersion(), getOpenFoamSubVersion());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -239,7 +237,7 @@ public class OpenFOAMEnvironment {
|
|||
}
|
||||
}
|
||||
|
||||
public static void trySettingParaviewExecutable() {
|
||||
public static void trySettingParaviewExecutables() {
|
||||
if (!OpenFOAMEnvironment.isParaviewPathSet() && OpenFOAMEnvironment.isEnvironementLoaded()) {
|
||||
File paraviewExecutable = getParaViewExecutablePath();
|
||||
if (paraviewExecutable != null) {
|
||||
|
|
@ -249,6 +247,15 @@ public class OpenFOAMEnvironment {
|
|||
logger.warn("ParaView path NOT set");
|
||||
}
|
||||
}
|
||||
if (!OpenFOAMEnvironment.isParaviewBatchPathSet() && OpenFOAMEnvironment.isEnvironementLoaded()) {
|
||||
File paraviewBatchExecutable = getParaViewBatchExecutablePath();
|
||||
if (paraviewBatchExecutable != null) {
|
||||
PrefUtil.setParaViewBatchEntry(paraviewBatchExecutable);
|
||||
logger.info("ParaView BATCH path set to {}", PrefUtil.getParaViewEntry());
|
||||
} else {
|
||||
logger.warn("ParaView BATCH path NOT set");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static File[] getOpenFoamDir() {
|
||||
|
|
@ -259,7 +266,6 @@ public class OpenFOAMEnvironment {
|
|||
File vendorHome = Paths.get(jarPath).getParent().getParent().getParent().getParent().toFile();
|
||||
logger.info("Check for valid OpenFOAM folder in {}", vendorHome);
|
||||
openFoamFolders = vendorHome.listFiles(new FileFilter() {
|
||||
|
||||
@Override
|
||||
public boolean accept(File file) {
|
||||
return file.isDirectory() && file.getName().startsWith("OpenFOAM");
|
||||
|
|
@ -271,16 +277,40 @@ public class OpenFOAMEnvironment {
|
|||
return openFoamFolders;
|
||||
}
|
||||
|
||||
private static File getParaViewExecutablePath() {
|
||||
File[] paraviewFolders = new File[0];
|
||||
File[] thirdPartyDirs = getThirdPartyDir();
|
||||
private static File getParaViewBatchExecutablePath() {
|
||||
File[] paraview_OSMESA_Folders = new File[0];
|
||||
File[] thirdPartyDirs = getThirdPartyDir(getOpenFoamVersion());
|
||||
if (Util.isVarArgsNotNullAndOfSize(1, thirdPartyDirs)) {
|
||||
File thirdPartyDir = thirdPartyDirs[0];
|
||||
logger.info("Check for valid ParaView folder in {}", thirdPartyDir);
|
||||
paraview_OSMESA_Folders = thirdPartyDir.listFiles(new FileFilter() {
|
||||
@Override
|
||||
public boolean accept(File file) {
|
||||
return file.isDirectory() && file.getName().startsWith("ParaView-") && file.getName().endsWith("osmesa");
|
||||
}
|
||||
});
|
||||
}
|
||||
if (Util.isVarArgsNotNull(paraview_OSMESA_Folders)) {
|
||||
for (File pvFolder : paraview_OSMESA_Folders) {
|
||||
File pvBatchExecutable = Paths.get(pvFolder.getAbsolutePath(), "platforms", "linux64Gcc", "bin", "pvbatch").toFile();
|
||||
if (pvBatchExecutable.exists()) {
|
||||
return pvBatchExecutable;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static File getParaViewExecutablePath() {
|
||||
File[] paraviewFolders = new File[0];
|
||||
File[] thirdPartyDirs = getThirdPartyDir(getOpenFoamVersion());
|
||||
if (Util.isVarArgsNotNullAndOfSize(1, thirdPartyDirs)) {
|
||||
File thirdPartyDir = thirdPartyDirs[0];
|
||||
logger.info("Check for valid ParaView BATCH folder in {}", thirdPartyDir);
|
||||
paraviewFolders = thirdPartyDir.listFiles(new FileFilter() {
|
||||
@Override
|
||||
public boolean accept(File file) {
|
||||
return file.isDirectory() && file.getName().startsWith("ParaView");
|
||||
return file.isDirectory() && file.getName().startsWith("ParaView-");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -295,28 +325,31 @@ public class OpenFOAMEnvironment {
|
|||
return null;
|
||||
}
|
||||
|
||||
private static File[] getThirdPartyDir() {
|
||||
File[] openFoamFolders = getOpenFoamDir();
|
||||
private static File[] getThirdPartyDir(final String version) {
|
||||
File[] thirdPartyFolders = new File[0];
|
||||
if (Util.isVarArgsNotNullAndOfSize(1, openFoamFolders)) {
|
||||
File vendorHome = getOpenFoamDir()[0].getParentFile();
|
||||
logger.info("Check for valid ThirdParty folder in {}", vendorHome);
|
||||
if (OpenFOAMEnvironment.isEnvironementLoaded()) {
|
||||
File openFoamDir = PrefUtil.getOpenFoamEntry();
|
||||
File vendorHome = openFoamDir.getParentFile();
|
||||
logger.info("Check for valid ThirdParty folder in {} for version {}", vendorHome, version);
|
||||
thirdPartyFolders = vendorHome.listFiles(new FileFilter() {
|
||||
@Override
|
||||
public boolean accept(File file) {
|
||||
return file.isDirectory() && file.getName().startsWith("ThirdParty");
|
||||
String name = file.getName();
|
||||
return file.isDirectory() && name.startsWith("ThirdParty") && name.endsWith(version);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
logger.warn("ThirdParty folder not found: missing ");
|
||||
}
|
||||
return thirdPartyFolders;
|
||||
|
||||
}
|
||||
|
||||
private static File[] getOpenFoamDirOS_onUnix() {
|
||||
public static File[] getOpenFoamDirOS_onUnix() {
|
||||
File[] openFoamFolders = new File[0];
|
||||
File optFolder = new File("/opt");
|
||||
logger.info("Check for valid OpenFOAM folder in {}", optFolder);
|
||||
openFoamFolders = optFolder.listFiles(new FileFilter() {
|
||||
|
||||
@Override
|
||||
public boolean accept(File file) {
|
||||
boolean isDir = file.isDirectory();
|
||||
|
|
@ -351,6 +384,9 @@ public class OpenFOAMEnvironment {
|
|||
}
|
||||
|
||||
public static boolean isEnvironementLoaded() {
|
||||
if(PrefUtil.isUsingDocker()){
|
||||
return true;
|
||||
}
|
||||
File openFoamDir = PrefUtil.getOpenFoamEntry();
|
||||
if (openFoamDir == null || !openFoamDir.exists() || !openFoamDir.isDirectory()) {
|
||||
return false;
|
||||
|
|
@ -366,6 +402,14 @@ public class OpenFOAMEnvironment {
|
|||
return true;
|
||||
}
|
||||
|
||||
public static boolean isParaviewBatchPathSet() {
|
||||
File paraViewBatch = PrefUtil.getParaViewBatchEntry();
|
||||
if (paraViewBatch == null || !paraViewBatch.exists() || !paraViewBatch.isFile() || !paraViewBatch.canExecute()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isFieldViewPathSet() {
|
||||
File fieldView = PrefUtil.getFieldViewEntry();
|
||||
if (fieldView == null || !fieldView.exists() || !fieldView.isFile() || !fieldView.canExecute()) {
|
||||
|
|
@ -402,9 +446,35 @@ public class OpenFOAMEnvironment {
|
|||
return new File("");
|
||||
}
|
||||
|
||||
public static String getParaviewVersion() {
|
||||
File pvHome = PrefUtil.getParaViewEntry();
|
||||
if (pvHome != null && pvHome.exists()) {
|
||||
private static String getOpenFoamVersion() {
|
||||
File openFoamEntry = PrefUtil.getOpenFoamEntry();
|
||||
if (openFoamEntry != null) {
|
||||
String name = openFoamEntry.getName();
|
||||
String[] split = StringUtils.split(name, "-");
|
||||
if (split.length > 1) {
|
||||
return split[1];
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
private static String getOpenFoamSubVersion() {
|
||||
File openFoamEntry = PrefUtil.getOpenFoamEntry();
|
||||
if (openFoamEntry != null) {
|
||||
String name = openFoamEntry.getName();
|
||||
String[] split = StringUtils.split(name, "-");
|
||||
if (split.length > 2) {
|
||||
return split[2];
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
private static String getParaviewVersion() {
|
||||
// File pvHome = PrefUtil.getParaViewEntry();
|
||||
File pvExe = PrefUtil.getParaViewBatchEntry();
|
||||
if (pvExe != null && pvExe.exists()) {
|
||||
File pvHome = pvExe.toPath().getParent().getParent().getParent().getParent().toFile();
|
||||
String name = pvHome.getName();
|
||||
if (name.startsWith("ParaView-")) {
|
||||
String version = name.substring("ParaView-".length());
|
||||
|
|
|
|||
|
|
@ -1,32 +1,35 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.controller;
|
||||
|
||||
import static javax.swing.JOptionPane.INFORMATION_MESSAGE;
|
||||
import static javax.swing.JOptionPane.OK_CANCEL_OPTION;
|
||||
import static javax.swing.JOptionPane.QUESTION_MESSAGE;
|
||||
import static javax.swing.JOptionPane.YES_NO_CANCEL_OPTION;
|
||||
|
||||
import java.io.File;
|
||||
import java.rmi.RemoteException;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.swing.Icon;
|
||||
|
|
@ -35,22 +38,28 @@ import javax.swing.JOptionPane;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import eu.engys.core.Arguments;
|
||||
import eu.engys.core.controller.actions.CommandException;
|
||||
import eu.engys.core.controller.actions.DeleteMesh;
|
||||
import eu.engys.core.executor.ExecutorTerminal;
|
||||
import eu.engys.core.executor.TerminalManager;
|
||||
import eu.engys.core.modules.ApplicationModule;
|
||||
import eu.engys.core.presentation.Action;
|
||||
import eu.engys.core.presentation.ActionContainer;
|
||||
import eu.engys.core.presentation.ActionManager;
|
||||
import eu.engys.core.project.CaseParameters;
|
||||
import eu.engys.core.project.InvalidProjectException;
|
||||
import eu.engys.core.project.CreateCaseDialog;
|
||||
import eu.engys.core.project.Model;
|
||||
import eu.engys.core.project.Project200To210Converter;
|
||||
import eu.engys.core.project.Project210To240Converter;
|
||||
import eu.engys.core.project.ProjectFolderAnalyzer;
|
||||
import eu.engys.core.project.ProjectFolderAnalyzer.WhenInDoubt;
|
||||
import eu.engys.core.project.ProjectFolderStructure;
|
||||
import eu.engys.core.project.ProjectReader;
|
||||
import eu.engys.core.project.ProjectWriter;
|
||||
import eu.engys.core.project.SolverState;
|
||||
import eu.engys.core.project.openFOAMProject;
|
||||
import eu.engys.core.project.mesh.MeshInfo;
|
||||
import eu.engys.core.project.mesh.MeshInfoWriter;
|
||||
import eu.engys.core.project.system.monitoringfunctionobjects.ParserView;
|
||||
import eu.engys.core.project.zero.cellzones.CellZonesBuilder;
|
||||
import eu.engys.util.ApplicationInfo;
|
||||
|
|
@ -65,20 +74,42 @@ import eu.engys.util.ui.UiUtil;
|
|||
|
||||
public abstract class AbstractController implements Controller, ActionContainer {
|
||||
|
||||
public static final String STOP_SOLVER = "Stop Solver";
|
||||
public static final String KILL_SOLVER = "Kill Solver";
|
||||
public static final String SOLVER_RUN = "solver.run";
|
||||
public static final String SOLVER_RUN_EDIT = "solver.run.edit";
|
||||
|
||||
public static final String SOLVER_STOP = "solver.stop";
|
||||
public static final String REFRESH_ONCE = "solver.refresh.once";
|
||||
public static final String RUN_ALL = "solver.run.all";
|
||||
|
||||
public static final String INITIALISE_SCRIPT = "initialise.fields";
|
||||
public static final String INITIALISE_SCRIPT_EDIT = "initialise.fields.edit";
|
||||
|
||||
public static final String MESH_CREATE = "mesh.create";
|
||||
public static final String MESH_CREATE_EDIT = "mesh.create.edit";
|
||||
public static final String MESH_CHECK = "mesh.check";
|
||||
public static final String MESH_CHECK_EDIT = "mesh.check.edit";
|
||||
public static final String MESH_DELETE = "mesh.delete";
|
||||
public static final String MESH_STRETCH = "mesh.stretch";
|
||||
public static final String DECOMPOSE = "decompose";
|
||||
|
||||
public static final String OPEN_RUN_MODE = "application.connection.window";
|
||||
public static final String OPEN_PARAMETERS_MANAGER = "application.parameters.manager";
|
||||
public static final String SAVE_SCREENSHOT = "save.screenshot";
|
||||
|
||||
public static final String STOP_SOLVER_LABEL = "Stop Solver";
|
||||
public static final String KILL_SOLVER_LABEL = "Kill Solver";
|
||||
|
||||
public static final String STOP_EXECUTION = "Stop Execution";
|
||||
public static final String KILL_PROCESS = "Kill Process";
|
||||
|
||||
public static final String STOP_FIELDS_INITIALISATION = "Stop Fields Initialisation";
|
||||
public static final String STOP_MESH_GENERATOR = "Stop Mesh Generator";
|
||||
|
||||
|
||||
public static final String CANCEL = "Cancel";
|
||||
public static final String CONTINUE_IN_BATCH = "Continue in Batch";
|
||||
|
||||
private static final Icon EXIT_BIG_ICON = ResourcesUtil.getIcon("application.exit.big.icon");
|
||||
private static final String EXIT_LABEL = ResourcesUtil.getString("application.exit.label");
|
||||
public static final String PARALLEL_WORKS = "application.parallel.works";
|
||||
|
||||
protected static final Icon EXIT_BIG_ICON = ResourcesUtil.getIcon("application.exit.big.icon");
|
||||
protected static final String EXIT_LABEL = ResourcesUtil.getString("application.exit.label");
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(Controller.class);
|
||||
|
||||
protected final Model model;
|
||||
|
|
@ -90,6 +121,8 @@ public abstract class AbstractController implements Controller, ActionContainer
|
|||
protected ControllerListener listener;
|
||||
protected CellZonesBuilder cellZonesBuilder;
|
||||
|
||||
public static boolean isServer = false;
|
||||
|
||||
public AbstractController(Model model, Set<ApplicationModule> modules, ProjectReader reader, ProjectWriter writer, CellZonesBuilder cellZonesBuilder, ProgressMonitor monitor, ScriptFactory scriptFactory) {
|
||||
this.cellZonesBuilder = cellZonesBuilder;
|
||||
logger.info("Loading {}", getClass().getSimpleName());
|
||||
|
|
@ -106,33 +139,61 @@ public abstract class AbstractController implements Controller, ActionContainer
|
|||
*/
|
||||
|
||||
@Override
|
||||
public void createCase(CaseParameters params) {
|
||||
if (params != null) {
|
||||
newCaseInAThread(params);
|
||||
public void createCase(CaseParameters params, OpenOptions oo) {
|
||||
if (params == null) {
|
||||
params = caseParametersOrNull();
|
||||
}
|
||||
|
||||
if (params.getBaseDir() != null) {
|
||||
newCaseInAThread(params, oo);
|
||||
}
|
||||
}
|
||||
|
||||
private void newCaseInAThread(final CaseParameters params) {
|
||||
private CaseParameters caseParametersOrNull() {
|
||||
final CaseParameters p = new CaseParameters();
|
||||
|
||||
ExecUtil.invokeAndWait(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
final CreateCaseDialog createCaseDialog = new CreateCaseDialog();
|
||||
createCaseDialog.showDialog();
|
||||
if (createCaseDialog.isOK()) {
|
||||
ActionManager.getInstance().invoke("application.startup.hide");
|
||||
p.setBaseDir(createCaseDialog.getParameters().getBaseDir());
|
||||
p.setnHierarchy(createCaseDialog.getParameters().getnHierarchy());
|
||||
p.setnProcessors(createCaseDialog.getParameters().getnProcessors());
|
||||
p.setParallel(createCaseDialog.getParameters().isParallel());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
private void newCaseInAThread(final CaseParameters params, final OpenOptions oo) {
|
||||
monitor.setTotal(10);
|
||||
monitor.start(String.format("Creating %s", params), false, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
create(params);
|
||||
create(params, oo);
|
||||
PrefUtil.putFile(PrefUtil.WORK_DIR, model.getProject().getBaseDir().getParentFile());
|
||||
if (oo != null && oo.getFilesToImport() != null) {
|
||||
importFiles(oo.getFilesToImport());
|
||||
}
|
||||
monitor.end();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create(final CaseParameters params) {
|
||||
public void create(final CaseParameters params, final OpenOptions oo) {
|
||||
if (listener != null) {
|
||||
listener.beforeNewCase();
|
||||
}
|
||||
clearModel();
|
||||
writer.create(params);
|
||||
if (listener != null) {
|
||||
listener.afterNewCase();
|
||||
listener.afterNewCase(oo != null ? oo.isLoadMesh() : true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -141,94 +202,124 @@ public abstract class AbstractController implements Controller, ActionContainer
|
|||
*/
|
||||
|
||||
@Override
|
||||
public void openCase(File file) {
|
||||
if (file == null) {
|
||||
file = fileToOpenOrNull();
|
||||
public void openCase(OpenOptions oo) {
|
||||
if (oo == null) {
|
||||
oo = fileToOpenOrNull();
|
||||
}
|
||||
if (file != null) {
|
||||
ActionManager.getInstance().invoke("application.startup.hide");
|
||||
openInAThread(file);
|
||||
if (oo != null && oo.getFile() != null) {
|
||||
openInAThread(oo);
|
||||
}
|
||||
Arguments.load3Dgeometry = true;
|
||||
Arguments.load3Dmesh = true;
|
||||
}
|
||||
|
||||
private File fileToOpenOrNull() {
|
||||
final File[] openFile = new File[1];
|
||||
Runnable r = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
File workDir = PrefUtil.getWorkDir(PrefUtil.WORK_DIR);
|
||||
HelyxFileChooser fileChooser = new HelyxFileChooser(workDir.getAbsolutePath());
|
||||
fileChooser.setTitle("Open");
|
||||
fileChooser.setSelectionMode(SelectionMode.DIRS_AND_ARCHIVES);
|
||||
|
||||
View3DOptions options = new View3DOptions();
|
||||
ReturnValue returnValue = fileChooser.showOpenDialog(options);
|
||||
if (returnValue.isApprove()) {
|
||||
File selectedCase = fileChooser.getSelectedFile();
|
||||
if (isSuitable(selectedCase)) {
|
||||
PrefUtil.putFile(PrefUtil.WORK_DIR, selectedCase.getParentFile());
|
||||
Arguments.load3Dgeometry = true;
|
||||
Arguments.load3Dmesh = options.loadMesh();
|
||||
openFile[0] = selectedCase;
|
||||
return;
|
||||
}
|
||||
JOptionPane.showMessageDialog(UiUtil.getActiveWindow(), selectedCase + "\n appears not to be a valid case folder", "File System Error", JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
openFile[0] = null;
|
||||
return;
|
||||
}
|
||||
};
|
||||
private OpenOptions fileToOpenOrNull() {
|
||||
OpenFile r = new OpenFile();
|
||||
ExecUtil.invokeAndWait(r);
|
||||
return openFile[0];
|
||||
return r.getOpenOptions();
|
||||
}
|
||||
|
||||
private void openInAThread(final File file) {
|
||||
class OpenFile implements Runnable {
|
||||
|
||||
private OpenOptions openOptions;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
File workDir = PrefUtil.getWorkDir(PrefUtil.WORK_DIR);
|
||||
HelyxFileChooser fileChooser = new HelyxFileChooser(workDir.getAbsolutePath());
|
||||
fileChooser.setTitle("Open");
|
||||
fileChooser.setSelectionMode(SelectionMode.DIRS_AND_ARCHIVES);
|
||||
|
||||
View3DOptions options = new View3DOptions();
|
||||
ReturnValue returnValue = fileChooser.showOpenDialog(options);
|
||||
if (returnValue.isApprove()) {
|
||||
File selectedCase = fileChooser.getSelectedFile();
|
||||
if (isSuitable(selectedCase)) {
|
||||
PrefUtil.putFile(PrefUtil.WORK_DIR, selectedCase.getParentFile());
|
||||
openOptions = OpenOptions.file(selectedCase, OpenMode.CHECK_FOLDER_ASK_USER).loadMesh(options.loadMesh());
|
||||
ActionManager.getInstance().invoke("application.startup.hide");
|
||||
return;
|
||||
}
|
||||
JOptionPane.showMessageDialog(UiUtil.getActiveWindow(), selectedCase + "\n appears not to be a valid case folder", "File System Error", JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
public OpenOptions getOpenOptions() {
|
||||
return openOptions;
|
||||
}
|
||||
}
|
||||
|
||||
private void openInAThread(final OpenOptions oo) {
|
||||
monitor.setTotal(10);
|
||||
monitor.start("Open " + file.getName(), false, new Runnable() {
|
||||
monitor.start("Open " + oo.getFile().getName(), false, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
open(file);
|
||||
open(oo);
|
||||
monitor.end();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void open(File file) {
|
||||
public void open(OpenOptions oo) {
|
||||
File file = oo.getFile();
|
||||
OpenMode mode = oo.getMode();
|
||||
|
||||
final File baseDir = file.isAbsolute() ? file : file.getAbsoluteFile();
|
||||
logger.debug("OPEN file {}", baseDir.getAbsolutePath());
|
||||
|
||||
if (listener != null) {
|
||||
listener.beforeLoadCase();
|
||||
}
|
||||
clearModel();
|
||||
|
||||
model.setProject(openFOAMProject.createProject(baseDir, monitor));
|
||||
switch (mode) {
|
||||
case SERIAL:
|
||||
model.setProject(openFOAMProject.newSerialProject(baseDir));
|
||||
break;
|
||||
case PARALLEL:
|
||||
model.setProject(openFOAMProject.newParallelProject(baseDir));
|
||||
break;
|
||||
case CURRENT_SETTINGS:
|
||||
case CHECK_FOLDER_ASK_USER:
|
||||
ProjectFolderStructure structure1 = new ProjectFolderAnalyzer(baseDir, monitor).checkAll(WhenInDoubt.ASK_USER);
|
||||
model.setProject(structure1.isParallel() ? openFOAMProject.newParallelProject(baseDir, structure1.getProcessors()) : openFOAMProject.newSerialProject(baseDir));
|
||||
break;
|
||||
case CHECK_FOLDER_PARALLEL:
|
||||
ProjectFolderStructure structure2 = new ProjectFolderAnalyzer(baseDir, monitor).checkAll(WhenInDoubt.READ_PARALLEL);
|
||||
model.setProject(structure2.isParallel() ? openFOAMProject.newParallelProject(baseDir, structure2.getProcessors()) : openFOAMProject.newSerialProject(baseDir));
|
||||
break;
|
||||
case MESH_ONLY:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
new Project200To210Converter(model.getProject(), cellZonesBuilder).convert();
|
||||
new Project210To240Converter(model.getProject()).convert();
|
||||
|
||||
_read();
|
||||
reader.read();
|
||||
|
||||
if (listener != null) {
|
||||
listener.afterLoadCase();
|
||||
listener.afterLoadCase(oo.isLoadMesh());
|
||||
}
|
||||
|
||||
logger.debug("OPEN file {} done.", baseDir.getName());
|
||||
}
|
||||
|
||||
protected abstract void importFiles(final File[] stlFiles);
|
||||
|
||||
@Override
|
||||
public void reopen(OpenOptions options) {
|
||||
public void reopen(OpenMode mode) {
|
||||
File baseDir = model.getProject().getBaseDir();
|
||||
int np = model.getProject().getProcessors();
|
||||
boolean parallel = model.getProject().isParallel();
|
||||
|
||||
logger.debug("REOPEN file {} with option {}", baseDir.getAbsolutePath(), options);
|
||||
logger.debug("REOPEN file {} in {} mode", baseDir.getAbsolutePath(), mode);
|
||||
if (listener != null) {
|
||||
listener.beforeReopenCase();
|
||||
}
|
||||
|
||||
if (options == OpenOptions.MESH_ONLY) {
|
||||
if (mode == OpenMode.MESH_ONLY) {
|
||||
reader.readMesh();
|
||||
if (listener != null) {
|
||||
listener.afterReopenCase();
|
||||
|
|
@ -237,23 +328,28 @@ public abstract class AbstractController implements Controller, ActionContainer
|
|||
}
|
||||
clearModel();
|
||||
|
||||
switch (options) {
|
||||
case SERIAL:
|
||||
model.setProject(openFOAMProject.newSerialProject(baseDir));
|
||||
break;
|
||||
case PARALLEL:
|
||||
model.setProject(openFOAMProject.newParallelProject(baseDir));
|
||||
break;
|
||||
case CHECK_FOLDER:
|
||||
model.setProject(openFOAMProject.createProject(baseDir, monitor));
|
||||
break;
|
||||
case CURRENT_SETTINGS:
|
||||
model.setProject(parallel ? openFOAMProject.newParallelProject(baseDir, np) : openFOAMProject.newSerialProject(baseDir));
|
||||
break;
|
||||
case MESH_ONLY:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
switch (mode) {
|
||||
case SERIAL:
|
||||
model.setProject(openFOAMProject.newSerialProject(baseDir));
|
||||
break;
|
||||
case PARALLEL:
|
||||
model.setProject(openFOAMProject.newParallelProject(baseDir));
|
||||
break;
|
||||
case CHECK_FOLDER_ASK_USER:
|
||||
ProjectFolderStructure structure1 = new ProjectFolderAnalyzer(baseDir, monitor).checkAll(WhenInDoubt.ASK_USER);
|
||||
model.setProject(structure1.isParallel() ? openFOAMProject.newParallelProject(baseDir, structure1.getProcessors()) : openFOAMProject.newSerialProject(baseDir));
|
||||
break;
|
||||
case CHECK_FOLDER_PARALLEL:
|
||||
ProjectFolderStructure structure2 = new ProjectFolderAnalyzer(baseDir, monitor).checkAll(WhenInDoubt.READ_PARALLEL);
|
||||
model.setProject(structure2.isParallel() ? openFOAMProject.newParallelProject(baseDir, structure2.getProcessors()) : openFOAMProject.newSerialProject(baseDir));
|
||||
break;
|
||||
case CURRENT_SETTINGS:
|
||||
model.setProject(parallel ? openFOAMProject.newParallelProject(baseDir, np) : openFOAMProject.newSerialProject(baseDir));
|
||||
break;
|
||||
case MESH_ONLY:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
reader.read();
|
||||
|
|
@ -264,18 +360,8 @@ public abstract class AbstractController implements Controller, ActionContainer
|
|||
logger.debug("Open file {} done.", baseDir.getName());
|
||||
}
|
||||
|
||||
private void _read() {
|
||||
try {
|
||||
reader.read();
|
||||
} catch (InvalidProjectException e) {
|
||||
logger.error(e.getMessage());
|
||||
JOptionPane.showMessageDialog(UiUtil.getActiveWindow(), e.getMessage(), "Project error", JOptionPane.ERROR_MESSAGE);
|
||||
clearModel();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reopenCase(final OpenOptions options) {
|
||||
public void reopenCase(final OpenMode options) {
|
||||
monitor.start("Reopen " + model.getProject().getBaseDir(), false, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
|
@ -299,7 +385,7 @@ public abstract class AbstractController implements Controller, ActionContainer
|
|||
}
|
||||
}
|
||||
|
||||
protected void saveInAThread(final File baseDir) {
|
||||
private void saveInAThread(final File baseDir) {
|
||||
monitor.info("");
|
||||
monitor.start("Save: " + baseDir.getAbsolutePath(), false, new Runnable() {
|
||||
@Override
|
||||
|
|
@ -308,6 +394,9 @@ public abstract class AbstractController implements Controller, ActionContainer
|
|||
monitor.end();
|
||||
}
|
||||
});
|
||||
if (ActionManager.getInstance().contains(SAVE_SCREENSHOT)) {
|
||||
ActionManager.getInstance().get(SAVE_SCREENSHOT).actionPerformed(null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -316,8 +405,9 @@ public abstract class AbstractController implements Controller, ActionContainer
|
|||
baseDir = model.getProject().getBaseDir();
|
||||
}
|
||||
logger.debug("Save file {}", baseDir.getAbsolutePath());
|
||||
if (listener != null)
|
||||
if (listener != null) {
|
||||
listener.beforeSaveCase();
|
||||
}
|
||||
writer.write(baseDir);
|
||||
writeScripts();
|
||||
if (listener != null) {
|
||||
|
|
@ -368,13 +458,16 @@ public abstract class AbstractController implements Controller, ActionContainer
|
|||
* MESH
|
||||
*/
|
||||
|
||||
@Action(key = "mesh.delete")
|
||||
@Action(key = MESH_DELETE)
|
||||
public void deleteMesh() {
|
||||
int retVal = JOptionPane.showConfirmDialog(UiUtil.getActiveWindow(), "This action will delete the existing mesh.\nContinue?", "Delete Mesh", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
|
||||
if (retVal == JOptionPane.YES_OPTION) {
|
||||
saveInAThread(model.getProject().getBaseDir());
|
||||
new DeleteMesh(model, this).executeClient();
|
||||
reopenCase(OpenOptions.CURRENT_SETTINGS);
|
||||
model.getMesh().setMeshInfo(new MeshInfo());
|
||||
new MeshInfoWriter(model).write();
|
||||
model.getProject().getSystemFolder().writeProjectDict(null);
|
||||
reopenCase(OpenMode.CURRENT_SETTINGS);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -393,10 +486,11 @@ public abstract class AbstractController implements Controller, ActionContainer
|
|||
*/
|
||||
|
||||
@Override
|
||||
public void createReport() {
|
||||
public void createReport(ExecutorTerminal terminal) {
|
||||
}
|
||||
|
||||
protected void clearModel() {
|
||||
@Override
|
||||
public void clearModel() {
|
||||
logger.info("--- CLEAR MODEL ---");
|
||||
model.init();
|
||||
model.setProject(null);
|
||||
|
|
@ -418,31 +512,24 @@ public abstract class AbstractController implements Controller, ActionContainer
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean allowActionsOnRunning(boolean exit) {
|
||||
if (model != null && model.getSolverModel() != null) {
|
||||
public boolean allowActionsOnRunning(boolean shouldAskConfirmation) {
|
||||
String exitMessage = EXIT_LABEL + " " + ApplicationInfo.getName() + "?";
|
||||
|
||||
boolean thereIsACaseLoaded = model != null && model.getSolverModel() != null;
|
||||
if (thereIsACaseLoaded) {
|
||||
SolverState solverState = model.getSolverModel().getServerState().getSolverState();
|
||||
if (solverState.isMeshing()) {
|
||||
return handleExitOnMeshRunning();
|
||||
} else if (solverState.isInitialising()) {
|
||||
return handleExitOnFieldsInitialising();
|
||||
} else if (solverState.isRunning()) {
|
||||
return handleExitOnSolverRunning();
|
||||
} else if (exit) {
|
||||
int option = JOptionPane.showConfirmDialog(UiUtil.getActiveWindow(), EXIT_LABEL + " " + ApplicationInfo.getName() + "?", EXIT_LABEL, JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE, EXIT_BIG_ICON);
|
||||
if (option == JOptionPane.CANCEL_OPTION) {
|
||||
return false;
|
||||
} else {
|
||||
if (getClient() != null && getClient().getServer() != null) {
|
||||
shutdownServer();
|
||||
if (solverState.isDoingSomething()) {
|
||||
return handleExitOnRunning();
|
||||
} else {// server not running
|
||||
if (shouldAskConfirmation) {
|
||||
int option = JOptionPane.showConfirmDialog(UiUtil.getActiveWindow(), exitMessage, EXIT_LABEL, OK_CANCEL_OPTION, INFORMATION_MESSAGE, EXIT_BIG_ICON);
|
||||
if (option == JOptionPane.CANCEL_OPTION) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
} else if (getClient() != null && getClient().getServer() != null) {
|
||||
shutdownServer();
|
||||
return true;
|
||||
}
|
||||
} else if (exit) {// If no case has been loaded yet
|
||||
int option = JOptionPane.showConfirmDialog(UiUtil.getActiveWindow(), EXIT_LABEL + " " + ApplicationInfo.getName() + "?", EXIT_LABEL, JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE, EXIT_BIG_ICON);
|
||||
} else if (shouldAskConfirmation) {
|
||||
int option = JOptionPane.showConfirmDialog(UiUtil.getActiveWindow(), exitMessage, EXIT_LABEL, OK_CANCEL_OPTION, INFORMATION_MESSAGE, EXIT_BIG_ICON);
|
||||
if (option == JOptionPane.CANCEL_OPTION) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -450,52 +537,15 @@ public abstract class AbstractController implements Controller, ActionContainer
|
|||
return true;
|
||||
}
|
||||
|
||||
private void shutdownServer() {
|
||||
try {
|
||||
getClient().getServer().shutdown();
|
||||
} catch (RemoteException e) {
|
||||
logger.error("Error shutting down server: {}" + e.getMessage());
|
||||
} catch (Exception e) {
|
||||
logger.error("Error shutting down server: {}" + e.getMessage());
|
||||
}
|
||||
}
|
||||
protected boolean handleExitOnRunning() {
|
||||
Object[] options = new Object[] { KILL_PROCESS, CONTINUE_IN_BATCH, CANCEL };
|
||||
String message = ApplicationInfo.getName() + " is running. Select an action to perform.";
|
||||
String title = ApplicationInfo.getName();
|
||||
|
||||
protected boolean handleExitOnMeshRunning() {
|
||||
Object[] options = new Object[] { STOP_MESH_GENERATOR, CONTINUE_IN_BATCH, CANCEL };
|
||||
int option = JOptionPane.showOptionDialog(UiUtil.getActiveWindow(), "Mesh Generator is Running. Select an action to perform.", "Mesh Generator Running", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[0]);
|
||||
int option = JOptionPane.showOptionDialog(UiUtil.getActiveWindow(), message, title, YES_NO_CANCEL_OPTION, QUESTION_MESSAGE, null, options, options[0]);
|
||||
|
||||
if (getClient() != null && option == JOptionPane.YES_OPTION) {
|
||||
kill();
|
||||
return true;
|
||||
} else if (getClient() != null && option == JOptionPane.NO_OPTION) {
|
||||
getClient().goToBatch();
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean handleExitOnFieldsInitialising() {
|
||||
Object[] options = new Object[] { STOP_FIELDS_INITIALISATION, CONTINUE_IN_BATCH, CANCEL };
|
||||
int option = JOptionPane.showOptionDialog(UiUtil.getActiveWindow(), "Fields Initialisation is Running. Select an action to perform.", "Fields Initialisation Running", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[0]);
|
||||
|
||||
if (getClient() != null && option == JOptionPane.YES_OPTION) {
|
||||
kill();
|
||||
return true;
|
||||
} else if (getClient() != null && option == JOptionPane.NO_OPTION) {
|
||||
getClient().goToBatch();
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean handleExitOnSolverRunning() {
|
||||
Object[] options = new Object[] { STOP_SOLVER, CONTINUE_IN_BATCH, CANCEL };
|
||||
int option = JOptionPane.showOptionDialog(UiUtil.getActiveWindow(), "Solver is Running. Select an action to perform.", "Solver Running", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[0]);
|
||||
|
||||
if (getClient() != null && option == JOptionPane.YES_OPTION) {
|
||||
getClient().stopCommand(Command.ANY);
|
||||
getClient().killCommand(Command.ANY);
|
||||
return true;
|
||||
} else if (getClient() != null && option == JOptionPane.NO_OPTION) {
|
||||
getClient().goToBatch();
|
||||
|
|
@ -533,6 +583,11 @@ public abstract class AbstractController implements Controller, ActionContainer
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TerminalManager getTerminalManager() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParserView getResidualView() {
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -1,28 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.controller;
|
||||
|
||||
import java.io.File;
|
||||
|
|
@ -35,10 +34,12 @@ import eu.engys.util.Util;
|
|||
public abstract class AbstractScriptFactory implements ScriptFactory {
|
||||
|
||||
protected static final String RUN_MESH = "Run Mesh";
|
||||
public static final String MESH_SERIAL_RUN = "mesh_serial.run";
|
||||
public static final String MESH_SERIAL_BAT = "mesh_serial.bat";
|
||||
public static final String MESH_PARALLEL_RUN = "mesh_parallel.run";
|
||||
public static final String MESH_PARALLEL_BAT = "mesh_parallel.bat";
|
||||
public static final String MESH_SERIAL = "mesh_serial";
|
||||
public static final String MESH_SERIAL_RUN = MESH_SERIAL + ".run";
|
||||
public static final String MESH_SERIAL_BAT = MESH_SERIAL + ".bat";
|
||||
public static final String MESH_PARALLEL = "mesh_parallel";
|
||||
public static final String MESH_PARALLEL_RUN = MESH_PARALLEL + ".run";
|
||||
public static final String MESH_PARALLEL_BAT = MESH_PARALLEL + ".bat";
|
||||
|
||||
protected static final String CHECK_MESH = "Check Mesh";
|
||||
public static final String CHECK_MESH_SERIAL_RUN = "check_mesh_serial.run";
|
||||
|
|
@ -46,15 +47,25 @@ public abstract class AbstractScriptFactory implements ScriptFactory {
|
|||
public static final String CHECK_MESH_PARALLEL_RUN = "check_mesh_parallel.run";
|
||||
public static final String CHECK_MESH_PARALLEL_BAT = "check_mesh_parallel.bat";
|
||||
|
||||
protected static final String SNAPPY_CHECK_MESH = "Snappy Check Mesh";
|
||||
public static final String SNAPPY_CHECK_MESH_SERIAL_RUN = "snappy_check_mesh_serial.run";
|
||||
public static final String SNAPPY_CHECK_MESH_SERIAL_BAT = "snappy_check_mesh_serial.bat";
|
||||
public static final String SNAPPY_CHECK_MESH_PARALLEL_RUN = "snappy_check_mesh_parallel.run";
|
||||
public static final String SNAPPY_CHECK_MESH_PARALLEL_BAT = "snappy_check_mesh_parallel.bat";
|
||||
|
||||
protected static final String RUN_CASE = "Run Case";
|
||||
public static final String SOLVER_SERIAL = "solver_serial";
|
||||
public static final String SOLVER_SERIAL_RUN = "solver_serial.run";
|
||||
public static final String SOLVER_SERIAL_BAT = "solver_serial.bat";
|
||||
public static final String SOLVER_PARALLEL = "solver_parallel";
|
||||
public static final String SOLVER_PARALLEL_RUN = "solver_parallel.run";
|
||||
public static final String SOLVER_PARALLEL_BAT = "solver_parallel.bat";
|
||||
|
||||
protected static final String INITIALISE_FIELDS = "Initialise Fields";
|
||||
public static final String INITIALISE_FIELDS_SERIAL = "initialiseFields_serial";
|
||||
public static final String INITIALISE_FIELDS_SERIAL_RUN = "initialiseFields_serial.run";
|
||||
public static final String INITIALISE_FIELDS_SERIAL_BAT = "initialiseFields_serial.bat";
|
||||
public static final String INITIALISE_FIELDS_PARALLEL = "initialiseFields_parallel";
|
||||
public static final String INITIALISE_FIELDS_PARALLEL_RUN = "initialiseFields_parallel.run";
|
||||
public static final String INITIALISE_FIELDS_PARALLEL_BAT = "initialiseFields_parallel.bat";
|
||||
|
||||
|
|
@ -64,6 +75,12 @@ public abstract class AbstractScriptFactory implements ScriptFactory {
|
|||
private static final String EXTRUDEMESH_PARALLEL_RUN = "extrudeMesh_parallel.run";
|
||||
private static final String EXTRUDEMESH_PARALLEL_BAT = "extrudeMesh_parallel.bat";
|
||||
|
||||
protected static final String EXPORT = "Export Results";
|
||||
private static final String EXPORT_SERIAL_RUN = "exportResults_serial.run";
|
||||
private static final String EXPORT_SERIAL_BAT = "exportResults_serial.bat";
|
||||
private static final String EXPORT_PARALLEL_RUN = "exportResults_parallel.run";
|
||||
private static final String EXPORT_PARALLEL_BAT = "exportResults_parallel.bat";
|
||||
|
||||
/*
|
||||
* MESH
|
||||
*/
|
||||
|
|
@ -102,14 +119,14 @@ public abstract class AbstractScriptFactory implements ScriptFactory {
|
|||
return script;
|
||||
}
|
||||
|
||||
private File getMeshParallelScript(Model model) {
|
||||
protected File getMeshParallelScript(Model model) {
|
||||
File file = new File(model.getProject().getBaseDir(), Util.isWindowsScriptStyle() ? MESH_PARALLEL_BAT : MESH_PARALLEL_RUN);
|
||||
writeFileIfNeeded(file, getParallelMeshScript());
|
||||
file.setExecutable(true);
|
||||
return file;
|
||||
}
|
||||
|
||||
private File getMeshSerialScript(Model model) {
|
||||
protected File getMeshSerialScript(Model model) {
|
||||
File file = new File(model.getProject().getBaseDir(), Util.isWindowsScriptStyle() ? MESH_SERIAL_BAT : MESH_SERIAL_RUN);
|
||||
writeFileIfNeeded(file, getSerialMeshScript());
|
||||
file.setExecutable(true);
|
||||
|
|
@ -136,9 +153,9 @@ public abstract class AbstractScriptFactory implements ScriptFactory {
|
|||
public List<String> getDefaultCheckMeshScript(Model model) {
|
||||
List<String> script = null;
|
||||
if (model.getProject().isParallel()) {
|
||||
script = getParallelMeshScript();
|
||||
script = getParallelCheckMeshScript();
|
||||
} else {
|
||||
script = getSerialMeshScript();
|
||||
script = getSerialCheckMeshScript();
|
||||
}
|
||||
return script;
|
||||
}
|
||||
|
|
@ -161,6 +178,47 @@ public abstract class AbstractScriptFactory implements ScriptFactory {
|
|||
|
||||
protected abstract List<String> getSerialCheckMeshScript();
|
||||
|
||||
@Override
|
||||
public File getSnappyCheckMeshScript(Model model) {
|
||||
File parallelScript = getSnappyCheckMeshParallelScript(model);
|
||||
File serialScript = getSnappyCheckMeshSerialScript(model);
|
||||
|
||||
if (model.getProject().isParallel()) {
|
||||
return parallelScript;
|
||||
} else {
|
||||
return serialScript;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getDefaultSnappyCheckMeshScript(Model model) {
|
||||
List<String> script = null;
|
||||
if (model.getProject().isParallel()) {
|
||||
script = getParallelSnappyCheckMeshScript();
|
||||
} else {
|
||||
script = getSerialSnappyCheckMeshScript();
|
||||
}
|
||||
return script;
|
||||
}
|
||||
|
||||
private File getSnappyCheckMeshParallelScript(Model model) {
|
||||
File file = new File(model.getProject().getBaseDir(), Util.isWindowsScriptStyle() ? CHECK_MESH_PARALLEL_BAT : CHECK_MESH_PARALLEL_RUN);
|
||||
writeFileIfNeeded(file, getParallelSnappyCheckMeshScript());
|
||||
file.setExecutable(true);
|
||||
return file;
|
||||
}
|
||||
|
||||
private File getSnappyCheckMeshSerialScript(Model model) {
|
||||
File file = new File(model.getProject().getBaseDir(), Util.isWindowsScriptStyle() ? CHECK_MESH_SERIAL_BAT : CHECK_MESH_SERIAL_RUN);
|
||||
writeFileIfNeeded(file, getSerialSnappyCheckMeshScript());
|
||||
file.setExecutable(true);
|
||||
return file;
|
||||
}
|
||||
|
||||
protected abstract List<String> getParallelSnappyCheckMeshScript();
|
||||
|
||||
protected abstract List<String> getSerialSnappyCheckMeshScript();
|
||||
|
||||
/*
|
||||
* SOLVER
|
||||
*/
|
||||
|
|
@ -315,18 +373,57 @@ public abstract class AbstractScriptFactory implements ScriptFactory {
|
|||
protected abstract List<String> getLinuxSetupCaseScript();
|
||||
|
||||
@Override
|
||||
public File getExportScript(Model model) {
|
||||
public File getReportScript(Model model) {
|
||||
File file = new File(model.getProject().getBaseDir(), "export.py");
|
||||
writeFileIfNeeded(file, getExportScript());
|
||||
writeFileIfNeeded(file, getReportScript());
|
||||
return file;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getDefaultExportScript(Model model) {
|
||||
return getExportScript();
|
||||
public List<String> getDefaultReportScript(Model model) {
|
||||
return getReportScript();
|
||||
}
|
||||
|
||||
protected abstract List<String> getExportScript();
|
||||
public abstract List<String> getReportScript();
|
||||
|
||||
@Override
|
||||
public File getExportScript(Model model) {
|
||||
File parallelScript = getExportParallelScript(model);
|
||||
File serialScript = getExporteSerialScript(model);
|
||||
|
||||
if (model.getProject().isParallel()) {
|
||||
return parallelScript;
|
||||
} else {
|
||||
return serialScript;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getDefaultExportScript(Model model) {
|
||||
List<String> script = null;
|
||||
if (model.getProject().isParallel()) {
|
||||
script = getParallelExportScript();
|
||||
} else {
|
||||
script = getSerialExportScript();
|
||||
}
|
||||
return script;
|
||||
}
|
||||
|
||||
protected File getExportParallelScript(Model model) {
|
||||
File file = new File(model.getProject().getBaseDir(), Util.isWindowsScriptStyle() ? EXPORT_PARALLEL_BAT : EXPORT_PARALLEL_RUN);
|
||||
writeFileIfNeeded(file, getParallelExportScript());
|
||||
return file;
|
||||
}
|
||||
|
||||
protected File getExporteSerialScript(Model model) {
|
||||
File file = new File(model.getProject().getBaseDir(), Util.isWindowsScriptStyle() ? EXPORT_SERIAL_BAT : EXPORT_SERIAL_RUN);
|
||||
writeFileIfNeeded(file, getSerialExportScript());
|
||||
return file;
|
||||
}
|
||||
|
||||
protected abstract List<String> getParallelExportScript();
|
||||
|
||||
protected abstract List<String> getSerialExportScript();
|
||||
|
||||
protected void writeFileIfNeeded(File file, List<String> script) {
|
||||
if (!file.exists()) {
|
||||
|
|
|
|||
|
|
@ -1,43 +1,42 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
|
||||
package eu.engys.core.controller;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import eu.engys.core.controller.Controller.OpenOptions;
|
||||
import eu.engys.core.controller.Controller.OpenMode;
|
||||
import eu.engys.core.project.CaseParameters;
|
||||
|
||||
public interface ApplicationActions {
|
||||
|
||||
void createCase(CaseParameters params);
|
||||
void createCase(CaseParameters params, OpenOptions oo);
|
||||
|
||||
void openCase(File file);
|
||||
void openCase(OpenOptions oo);
|
||||
|
||||
void reopenCase(OpenOptions options);
|
||||
void reopenCase(OpenMode mode);
|
||||
|
||||
void saveCase(File file);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,46 +1,48 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.controller;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import eu.engys.core.controller.Controller.OpenOptions;
|
||||
import eu.engys.core.controller.actions.TimeoutException;
|
||||
import eu.engys.core.controller.Controller.OpenMode;
|
||||
import eu.engys.core.project.CaseParameters;
|
||||
|
||||
public interface BatchActions {
|
||||
|
||||
void create(CaseParameters params);
|
||||
void open(File file);
|
||||
void reopen(OpenOptions options);
|
||||
void save(File file);
|
||||
void create(CaseParameters params, OpenOptions oo);
|
||||
|
||||
void open(OpenOptions oo);
|
||||
|
||||
void reopen(OpenMode options);
|
||||
|
||||
void save(File file);
|
||||
|
||||
void setupCase();
|
||||
void stopCase() throws TimeoutException;
|
||||
|
||||
void stopCase() throws Exception;
|
||||
|
||||
void kill();
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,28 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.controller;
|
||||
|
||||
import javax.swing.JComponent;
|
||||
|
|
@ -35,12 +34,10 @@ public interface Client {
|
|||
|
||||
void executeCommands(Command... command);
|
||||
|
||||
ParserView getResidualView();
|
||||
ParserView getResidualsView();
|
||||
|
||||
void refreshOnce();
|
||||
|
||||
void loadState();
|
||||
|
||||
void stopCommand(Command command);
|
||||
|
||||
void killCommand(Command command);
|
||||
|
|
@ -59,4 +56,6 @@ public interface Client {
|
|||
|
||||
void waitForFinished();
|
||||
|
||||
void justConnect();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,50 +1,56 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.controller;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import eu.engys.util.Util;
|
||||
|
||||
public class ClientInfo implements Serializable {
|
||||
|
||||
private String clientID;
|
||||
private boolean connected;
|
||||
|
||||
private ClientInfo(boolean connected) {
|
||||
private ClientInfo(String clientID, boolean connected) {
|
||||
this.clientID = clientID;
|
||||
this.connected = connected;
|
||||
}
|
||||
|
||||
public boolean isConnected() {
|
||||
return connected;
|
||||
}
|
||||
public String getClientID() {
|
||||
return clientID;
|
||||
}
|
||||
|
||||
public static ClientInfo clientConnected() {
|
||||
return new ClientInfo(true);
|
||||
return new ClientInfo(Util.generateID(), true);
|
||||
}
|
||||
|
||||
public static ClientInfo clientDisconnected() {
|
||||
return new ClientInfo(false);
|
||||
public static ClientInfo clientDisconnected(String clientID) {
|
||||
return new ClientInfo(clientID, false);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,28 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.controller;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
|
@ -41,13 +40,6 @@ public class ClientServerCommand implements Serializable {
|
|||
this.parallel = false;
|
||||
this.startParsers = false;
|
||||
}
|
||||
|
||||
public ClientServerCommand(Command command, String open, boolean parallel, boolean startParsers) {
|
||||
this.commands = new Command[]{command};
|
||||
this.open = open;
|
||||
this.parallel = parallel;
|
||||
this.startParsers = startParsers;
|
||||
}
|
||||
|
||||
public Command getCommand() {
|
||||
return commands[0];
|
||||
|
|
|
|||
|
|
@ -1,28 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.controller;
|
||||
|
||||
public enum Command {
|
||||
|
|
@ -32,6 +31,7 @@ public enum Command {
|
|||
INITIALISE_FIELDS("", ""),
|
||||
RUN_ALL("", ""),
|
||||
EXTRUDE_TO_REGION("", ""),
|
||||
EXPORT_RESULTS("", ""),
|
||||
ANY("any", "Any"),
|
||||
NONE("none", "None");
|
||||
|
||||
|
|
|
|||
|
|
@ -1,28 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.controller;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
|
@ -66,6 +65,15 @@ public class CommandInfo implements Serializable {
|
|||
ci.success = false;
|
||||
return ci;
|
||||
}
|
||||
|
||||
public static CommandInfo error(String message, Exception e) {
|
||||
logger.warn(">>> SERVER WARNING: {}", message);
|
||||
CommandInfo ci = new CommandInfo();
|
||||
ci.message = message;
|
||||
ci.exception = e;
|
||||
ci.success = false;
|
||||
return ci;
|
||||
}
|
||||
|
||||
public static CommandInfo notConnected() {
|
||||
CommandInfo ci = new CommandInfo();
|
||||
|
|
@ -88,4 +96,9 @@ public class CommandInfo implements Serializable {
|
|||
return ci;
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CommandInfo - msg: " + message + ", job ID: " + jobID + ", succes: " + success + ", exception: " + exception;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,32 +1,33 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.controller;
|
||||
|
||||
import eu.engys.core.controller.actions.CommandException;
|
||||
import eu.engys.core.executor.ExecutorTerminal;
|
||||
import eu.engys.core.executor.TerminalManager;
|
||||
import eu.engys.core.parameters.Parameters;
|
||||
import eu.engys.core.project.ProjectReader;
|
||||
import eu.engys.core.project.ProjectWriter;
|
||||
import eu.engys.core.project.system.monitoringfunctionobjects.ParserView;
|
||||
|
|
@ -37,8 +38,8 @@ public interface Controller extends ApplicationActions, BatchActions {
|
|||
EXIT, CONTINUE, NONE
|
||||
}
|
||||
|
||||
public enum OpenOptions {
|
||||
SERIAL, PARALLEL, CURRENT_SETTINGS, CHECK_FOLDER, MESH_ONLY
|
||||
public enum OpenMode {
|
||||
SERIAL, PARALLEL, CURRENT_SETTINGS, CHECK_FOLDER_ASK_USER, CHECK_FOLDER_PARALLEL, MESH_ONLY
|
||||
}
|
||||
|
||||
boolean isDemo();
|
||||
|
|
@ -53,9 +54,9 @@ public interface Controller extends ApplicationActions, BatchActions {
|
|||
public Server getServer();
|
||||
public ParserView getResidualView();
|
||||
|
||||
boolean allowActionsOnRunning(boolean exit);
|
||||
boolean allowActionsOnRunning(boolean shouldAskConfirmation);
|
||||
|
||||
void createReport();
|
||||
void createReport(ExecutorTerminal terminal);
|
||||
|
||||
void executeCommand(Command command) throws CommandException;
|
||||
|
||||
|
|
@ -65,4 +66,10 @@ public interface Controller extends ApplicationActions, BatchActions {
|
|||
|
||||
boolean isRunningCommand();
|
||||
|
||||
void applyParameters(Parameters parameters);
|
||||
|
||||
TerminalManager getTerminalManager();
|
||||
|
||||
void clearModel();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,39 +1,36 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.controller;
|
||||
|
||||
|
||||
public interface ControllerListener {
|
||||
|
||||
void beforeNewCase();
|
||||
void afterNewCase();
|
||||
void afterNewCase(boolean loadMesh);
|
||||
|
||||
void beforeLoadCase();
|
||||
void afterLoadCase();
|
||||
void afterLoadCase(boolean loadMesh);
|
||||
|
||||
void beforeReopenCase();
|
||||
void afterReopenCase();
|
||||
|
|
@ -57,4 +54,5 @@ public interface ControllerListener {
|
|||
|
||||
void afterBlockMesh();
|
||||
|
||||
void afterSetupCase();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,41 +1,46 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.controller;
|
||||
|
||||
import eu.engys.core.controller.actions.NamingConvention;
|
||||
import eu.engys.core.project.geometry.Surface;
|
||||
|
||||
public class DefaultNamingConvention implements NamingConvention {
|
||||
@Override
|
||||
public String getCellZoneName(Surface surface) {
|
||||
return surface.getZoneName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPatchName(Surface surface) {
|
||||
return surface.getPatchName();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCellZoneName(Surface surface) {
|
||||
return surface.getCellZoneName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFaceZoneName(Surface surface) {
|
||||
return surface.getFaceZoneName();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,35 +1,37 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.controller;
|
||||
|
||||
import static eu.engys.core.OpenFOAMEnvironment.loadEnvironment;
|
||||
import static eu.engys.core.OpenFOAMEnvironment.printHeader;
|
||||
import static eu.engys.core.OpenFOAMEnvironment.printVariables;
|
||||
import static eu.engys.util.OpenFOAMCommands.BLOCK_MESH;
|
||||
import static eu.engys.util.OpenFOAMCommands.CHECK_MESH_PARALLEL;
|
||||
import static eu.engys.util.OpenFOAMCommands.CHECK_MESH_PARALLEL_CONSTANT;
|
||||
import static eu.engys.util.OpenFOAMCommands.CHECK_MESH_SERIAL;
|
||||
import static eu.engys.util.OpenFOAMCommands.CHECK_MESH_SERIAL_CONSTANT;
|
||||
import static eu.engys.util.OpenFOAMCommands.DECOMPOSE_PAR;
|
||||
import static eu.engys.util.OpenFOAMCommands.DECOMPOSE_PAR_ALLREGIONS;
|
||||
import static eu.engys.util.OpenFOAMCommands.DECOMPOSE_PAR_CONSTANT_ALLREGIONS;
|
||||
|
|
@ -42,8 +44,6 @@ import static eu.engys.util.OpenFOAMCommands.RUN_CASE_PARALLEL;
|
|||
import static eu.engys.util.OpenFOAMCommands.RUN_CASE_SERIAL;
|
||||
import static eu.engys.util.OpenFOAMCommands.RUN_MESH_PARALLEL;
|
||||
import static eu.engys.util.OpenFOAMCommands.RUN_MESH_SERIAL;
|
||||
//import static eu.engys.util.OpenFOAMCommands.CHECK_MESH_PARALLEL;
|
||||
//import static eu.engys.util.OpenFOAMCommands.CHECK_MESH_SERIAL;
|
||||
import static eu.engys.util.OpenFOAMCommands.SNAPPY_CHECK_MESH_PARALLEL;
|
||||
import static eu.engys.util.OpenFOAMCommands.SNAPPY_CHECK_MESH_SERIAL;
|
||||
|
||||
|
|
@ -102,7 +102,7 @@ public class DefaultScriptFactory extends AbstractScriptFactory {
|
|||
sb.newLine();
|
||||
sb.appendIf(performBlockMesh(), BLOCK_MESH());
|
||||
sb.newLine();
|
||||
sb.appendIf(performBlockMesh(), DECOMPOSE_PAR());
|
||||
sb.appendIf(performBlockMesh(), DECOMPOSE_PAR(Collections.<String> emptySet()));
|
||||
sb.newLine();
|
||||
sb.append(RUN_MESH_PARALLEL());
|
||||
sb.newLine();
|
||||
|
|
@ -118,7 +118,7 @@ public class DefaultScriptFactory extends AbstractScriptFactory {
|
|||
printVariables(sb);
|
||||
loadEnvironment(sb);
|
||||
sb.newLine();
|
||||
sb.append(SNAPPY_CHECK_MESH_SERIAL());
|
||||
sb.append(meshOnZero() ? CHECK_MESH_SERIAL() : CHECK_MESH_SERIAL_CONSTANT());
|
||||
sb.newLine();
|
||||
return sb.getLines();
|
||||
}
|
||||
|
|
@ -130,6 +130,30 @@ public class DefaultScriptFactory extends AbstractScriptFactory {
|
|||
printVariables(sb);
|
||||
loadEnvironment(sb);
|
||||
sb.newLine();
|
||||
sb.append(meshOnZero() ? CHECK_MESH_PARALLEL() : CHECK_MESH_PARALLEL_CONSTANT());
|
||||
sb.newLine();
|
||||
return sb.getLines();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<String> getSerialSnappyCheckMeshScript() {
|
||||
ScriptBuilder sb = new ScriptBuilder();
|
||||
printHeader(sb, SNAPPY_CHECK_MESH);
|
||||
printVariables(sb);
|
||||
loadEnvironment(sb);
|
||||
sb.newLine();
|
||||
sb.append(SNAPPY_CHECK_MESH_SERIAL());
|
||||
sb.newLine();
|
||||
return sb.getLines();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<String> getParallelSnappyCheckMeshScript() {
|
||||
ScriptBuilder sb = new ScriptBuilder();
|
||||
printHeader(sb, SNAPPY_CHECK_MESH);
|
||||
printVariables(sb);
|
||||
loadEnvironment(sb);
|
||||
sb.newLine();
|
||||
sb.append(SNAPPY_CHECK_MESH_PARALLEL());
|
||||
sb.newLine();
|
||||
return sb.getLines();
|
||||
|
|
@ -216,7 +240,7 @@ public class DefaultScriptFactory extends AbstractScriptFactory {
|
|||
sb.newLine();
|
||||
sb.appendIf(meshOnZero(), RECONSTRUCT_PAR_MESH(), RECONSTRUCT_PAR_MESH_CONSTANT());
|
||||
sb.append(EXTRUDE_REGION_TO_MESH());
|
||||
sb.appendIf(meshOnZero(), DECOMPOSE_PAR_ALLREGIONS(), DECOMPOSE_PAR_CONSTANT_ALLREGIONS());
|
||||
sb.appendIf(meshOnZero(), DECOMPOSE_PAR_ALLREGIONS(Collections.<String> emptySet()), DECOMPOSE_PAR_CONSTANT_ALLREGIONS(Collections.<String> emptySet()));
|
||||
sb.newLine();
|
||||
return sb.getLines();
|
||||
}
|
||||
|
|
@ -263,13 +287,13 @@ public class DefaultScriptFactory extends AbstractScriptFactory {
|
|||
|
||||
boolean copy = false;
|
||||
for (String l : lines) {
|
||||
if(l.startsWith(end)){
|
||||
if (l.startsWith(end)) {
|
||||
break;
|
||||
}
|
||||
if(copy){
|
||||
if (copy) {
|
||||
support.add(l);
|
||||
}
|
||||
if(l.startsWith(start)){
|
||||
if (l.startsWith(start)) {
|
||||
copy = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -280,17 +304,13 @@ public class DefaultScriptFactory extends AbstractScriptFactory {
|
|||
InputStream inputStream = DefaultScriptFactory.class.getClassLoader().getResourceAsStream("eu/engys/resources/driver.pbs");
|
||||
try {
|
||||
String body = IOUtils.readStringFromStream(inputStream);
|
||||
return Arrays.asList(body.split(IOUtils.EOL));
|
||||
return Arrays.asList(body.split(IOUtils.LNX_EOL));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
private List<String> getWindowsQueueDriver() {
|
||||
throw new RuntimeException("NOT IMPLEMENTED");
|
||||
}
|
||||
|
||||
private List<String> getLinuxQueueDriver(List<String> body) {
|
||||
|
||||
String name = model.getProject().getBaseDir().getName();
|
||||
|
|
@ -366,7 +386,17 @@ public class DefaultScriptFactory extends AbstractScriptFactory {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected List<String> getExportScript() {
|
||||
protected List<String> getSerialExportScript() {
|
||||
throw new RuntimeException("NOT IMPLEMENTED");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<String> getParallelExportScript() {
|
||||
throw new RuntimeException("NOT IMPLEMENTED");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getReportScript() {
|
||||
throw new RuntimeException("NOT IMPLEMENTED");
|
||||
}
|
||||
|
||||
|
|
@ -380,7 +410,7 @@ public class DefaultScriptFactory extends AbstractScriptFactory {
|
|||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return Arrays.asList(driverString.split(IOUtils.EOL));
|
||||
return Arrays.asList(driverString.split(IOUtils.LNX_EOL));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -1,35 +1,36 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.controller;
|
||||
|
||||
import static eu.engys.core.project.system.SnappyHexMeshDict.BAFFLE_KEY;
|
||||
import static eu.engys.core.project.system.SnappyHexMeshDict.BOUNDARY_KEY;
|
||||
import static eu.engys.core.project.system.SnappyHexMeshDict.CELL_ZONE_KEY;
|
||||
import static eu.engys.core.project.system.SnappyHexMeshDict.FACE_TYPE_KEY;
|
||||
import static eu.engys.core.project.system.SnappyHexMeshDict.FACE_ZONE_KEY;
|
||||
import static eu.engys.core.project.system.SnappyHexMeshDict.INSIDE;
|
||||
import static eu.engys.core.project.system.SnappyHexMeshDict.IS_CELL_ZONE_KEY;
|
||||
import static eu.engys.core.project.system.SnappyHexMeshDict.LEVELS_KEY;
|
||||
import static eu.engys.core.project.system.SnappyHexMeshDict.MODE_KEY;
|
||||
import static eu.engys.core.project.system.SnappyHexMeshDict.NONE_KEY;
|
||||
|
|
@ -48,20 +49,25 @@ import eu.engys.core.project.geometry.Surface;
|
|||
import eu.engys.core.project.geometry.surface.Region;
|
||||
import eu.engys.core.project.geometry.surface.Solid;
|
||||
import eu.engys.core.project.zero.cellzones.CellZone;
|
||||
import eu.engys.core.project.zero.facezones.FaceZone;
|
||||
import eu.engys.core.project.zero.patches.BoundaryConditions;
|
||||
import eu.engys.core.project.zero.patches.BoundaryType;
|
||||
import eu.engys.core.project.zero.patches.Patch;
|
||||
|
||||
public class GeometryToMesh {
|
||||
|
||||
public static final String SLAVE_SUFFIX = "_slave";
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(GeometryToMesh.class);
|
||||
|
||||
private Model model;
|
||||
private List<Patch> patches = new ArrayList<>();
|
||||
private List<CellZone> cellZones = new ArrayList<>();
|
||||
private List<FaceZone> faceZones = new ArrayList<>();
|
||||
|
||||
private List<Surface> willBePatches = new ArrayList<>();
|
||||
private List<Surface> willBeCellZones = new ArrayList<>();
|
||||
private List<Surface> willBeFaceZones = new ArrayList<>();
|
||||
|
||||
private NamingConvention naming;
|
||||
|
||||
|
|
@ -84,26 +90,27 @@ public class GeometryToMesh {
|
|||
public void execute() {
|
||||
model.getPatches().clear();
|
||||
model.getCellZones().clear();
|
||||
model.getFaceZones().clear();
|
||||
|
||||
extractPatchesFromGeometry();
|
||||
|
||||
model.getPatches().addPatches(patches);
|
||||
model.getCellZones().addZones(cellZones);
|
||||
}
|
||||
|
||||
public List<Surface> getWillBePatches() {
|
||||
return willBePatches;
|
||||
}
|
||||
|
||||
public List<Surface> getWillBeCellZones() {
|
||||
return willBeCellZones;
|
||||
model.getFaceZones().addZones(faceZones);
|
||||
}
|
||||
|
||||
private void extractPatchesFromGeometry() {
|
||||
for (Surface surface : model.getGeometry().getSurfaces()) {
|
||||
logger.debug("Surface {}: {} {} {}", surface.getName(), surface.getSurfaceDictionary(), surface.getVolumeDictionary(), surface.getZoneDictionary());
|
||||
|
||||
surfaceToPatch(surface);
|
||||
surfaceToCellZone(surface);
|
||||
surfaceToFaceZone(surface);
|
||||
if (willCreatePatches(surface)) {
|
||||
zoneToPatches(surface);
|
||||
} else {
|
||||
logger.debug("'{}' does NOT become a PATCH+SLAVE", surface.getName());
|
||||
}
|
||||
}
|
||||
|
||||
if (model.getGeometry().hasBlock()) {
|
||||
|
|
@ -111,25 +118,49 @@ public class GeometryToMesh {
|
|||
}
|
||||
}
|
||||
|
||||
private void surfaceToPatch(Surface surface) {
|
||||
if (surface.isSingleton()) {
|
||||
addPatch(surface);
|
||||
} else if (surface.hasRegions()) {
|
||||
for (Region region : surface.getRegions()) {
|
||||
addPatch(region);
|
||||
}
|
||||
} else {
|
||||
addPatch(surface);
|
||||
}
|
||||
}
|
||||
|
||||
private void surfaceToCellZone(Surface surface) {
|
||||
if (willBeACellZone(surface)) {
|
||||
if (willCreatePatches(surface)) {
|
||||
zoneToPatches(surface);
|
||||
} else {
|
||||
logger.debug("'{}' does NOT become a PATCH+SLAVE", surface.getName());
|
||||
}
|
||||
String zoneName = naming.getCellZoneName(surface);
|
||||
CellZone zone = new CellZone(zoneName);
|
||||
zone.setName(zoneName);
|
||||
zone.setVisible(true);
|
||||
zone.setLoaded(true);
|
||||
|
||||
logger.debug("'{}' becomes a ZONE with name {}", surface.getName(), zoneName);
|
||||
logger.debug("'{}' becomes a CELLZONE with name {}", surface.getName(), zoneName);
|
||||
|
||||
cellZones.add(zone);
|
||||
willBeCellZones.add(surface);
|
||||
} else {
|
||||
logger.debug("'{}' does NOT become a ZONE", surface.getName());
|
||||
logger.debug("'{}' does NOT become a CELLZONE", surface.getName());
|
||||
}
|
||||
}
|
||||
|
||||
private void surfaceToFaceZone(Surface surface) {
|
||||
if (willBeAFaceZone(surface)) {
|
||||
String zoneName = naming.getFaceZoneName(surface);
|
||||
FaceZone zone = new FaceZone(zoneName);
|
||||
zone.setName(zoneName);
|
||||
zone.setVisible(true);
|
||||
zone.setLoaded(true);
|
||||
|
||||
logger.debug("'{}' becomes a FACEZONE with name {}", surface.getName(), zoneName);
|
||||
|
||||
faceZones.add(zone);
|
||||
willBeFaceZones.add(surface);
|
||||
} else {
|
||||
logger.debug("'{}' does NOT become a FACEZONE", surface.getName());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -148,15 +179,48 @@ public class GeometryToMesh {
|
|||
addPatchAndSlave(surface);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean willBeAPatch(Surface surface) {
|
||||
boolean typePlane = surface.getType().isPlane();
|
||||
boolean singletonSTLRefinementOnly = surface.getType().isStl() && surface.isSingleton() && isSurfaceRefinementOnly(surface);
|
||||
boolean typeSolidAndParentOK = surface.getType().isSolid() && willBeAPatch(((Solid) surface).getParent());
|
||||
boolean notSolidButRefinementOnly = !surface.getType().isSolid() && isSurfaceRefinementOnly(surface);
|
||||
return typePlane || singletonSTLRefinementOnly || typeSolidAndParentOK || notSolidButRefinementOnly;
|
||||
}
|
||||
|
||||
private boolean willBeACellZone(Surface surface) {
|
||||
Dictionary zoneDictionary = surface.getZoneDictionary();
|
||||
return zoneDictionary != null && !zoneDictionary.isEmpty() && zoneDictionary.isField(FACE_ZONE_KEY) && zoneDictionary.found(FACE_TYPE_KEY) && !zoneDictionary.lookup(FACE_TYPE_KEY).equals(NONE_KEY);
|
||||
if (zoneDictionary == null) {
|
||||
return false;
|
||||
} else {
|
||||
boolean hasCellZoneField = zoneDictionary.isField(CELL_ZONE_KEY);
|
||||
boolean isCellZoneTrue = zoneDictionary.found(IS_CELL_ZONE_KEY) && zoneDictionary.lookupBoolean(IS_CELL_ZONE_KEY);
|
||||
boolean faceTypeIsNotNone = zoneDictionary.found(FACE_TYPE_KEY) && !zoneDictionary.lookup(FACE_TYPE_KEY).equals(NONE_KEY);
|
||||
return hasCellZoneField && isCellZoneTrue && faceTypeIsNotNone;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean willBeAFaceZone(Surface surface) {
|
||||
Dictionary zoneDictionary = surface.getZoneDictionary();
|
||||
if (zoneDictionary == null) {
|
||||
return false;
|
||||
} else {
|
||||
boolean hasFaceZoneField = zoneDictionary.isField(FACE_ZONE_KEY);
|
||||
boolean faceTypeIsNotNone = zoneDictionary.found(FACE_TYPE_KEY) && !zoneDictionary.lookup(FACE_TYPE_KEY).equals(NONE_KEY);
|
||||
return hasFaceZoneField && faceTypeIsNotNone;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean willCreatePatches(Surface surface) {
|
||||
Dictionary zoneDictionary = surface.getZoneDictionary();
|
||||
return zoneDictionary.found(FACE_TYPE_KEY) && (zoneDictionary.lookup(FACE_TYPE_KEY).equals(BOUNDARY_KEY) || zoneDictionary.lookup(FACE_TYPE_KEY).equals(BAFFLE_KEY));
|
||||
if (zoneDictionary == null) {
|
||||
return false;
|
||||
} else {
|
||||
boolean faceTypeIsBoundary = zoneDictionary.found(FACE_TYPE_KEY) && (zoneDictionary.lookup(FACE_TYPE_KEY).equals(BOUNDARY_KEY));
|
||||
boolean faceTypeIsBaffle = zoneDictionary.found(FACE_TYPE_KEY) && (zoneDictionary.lookup(FACE_TYPE_KEY).equals(BAFFLE_KEY));
|
||||
|
||||
return faceTypeIsBoundary || faceTypeIsBaffle;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isBoundary(Surface surface) {
|
||||
|
|
@ -169,18 +233,6 @@ public class GeometryToMesh {
|
|||
return zoneDictionary.lookup(FACE_TYPE_KEY).equals(BAFFLE_KEY);
|
||||
}
|
||||
|
||||
private void surfaceToPatch(Surface surface) {
|
||||
if (surface.isSingleton()) {
|
||||
addPatch(surface);
|
||||
} else if (surface.hasRegions()) {
|
||||
for (Region region : surface.getRegions()) {
|
||||
addPatch(region);
|
||||
}
|
||||
} else {
|
||||
addPatch(surface);
|
||||
}
|
||||
}
|
||||
|
||||
private void addPatch(Surface surface) {
|
||||
if (willBeAPatch(surface)) {
|
||||
String patchName = naming.getPatchName(surface);
|
||||
|
|
@ -194,7 +246,7 @@ public class GeometryToMesh {
|
|||
|
||||
private void addPatchAndSlave(Surface surface) {
|
||||
String patchName = naming.getPatchName(surface);
|
||||
String slaveName = patchName + "_slave";
|
||||
String slaveName = patchName + SLAVE_SUFFIX;
|
||||
logger.debug("'{}' becomes 2 PATCHES with name {} and {}", surface.getName(), patchName, slaveName);
|
||||
patches.add(newPatch(patchName));
|
||||
willBePatches.add(surface);
|
||||
|
|
@ -209,25 +261,19 @@ public class GeometryToMesh {
|
|||
patch.setVisible(true);
|
||||
patch.setLoaded(true);
|
||||
patch.setEmpty(false);
|
||||
patch.setPhisicalType(BoundaryType.getDefaultType());
|
||||
patch.setPhysicalType(BoundaryType.getDefaultType());
|
||||
patch.setBoundaryConditions(new BoundaryConditions());
|
||||
return patch;
|
||||
}
|
||||
|
||||
private boolean willBeAPatch(Surface surface) {
|
||||
return surface.getType().isPlane()
|
||||
|| (surface.getType().isStl() && surface.isSingleton() && isSurfaceRefinementOnly(surface))
|
||||
|| (surface.getType().isSolid() && willBeAPatch(((Solid)surface).getParent()) )
|
||||
|| (!surface.getType().isSolid() && isSurfaceRefinementOnly(surface));
|
||||
}
|
||||
|
||||
private boolean isSurfaceRefinementOnly(Surface surface) {
|
||||
boolean surfaceRefinement = isSurfaceRefinement(surface);
|
||||
boolean volumeRefinement = isVolumeRefinement(surface);
|
||||
boolean willBeACellZone = willBeACellZone(surface);
|
||||
boolean willBeAFaceZone = willBeAFaceZone(surface);
|
||||
|
||||
// System.err.println("GeometryToMesh.isSurfaceRefinementOnly() surfaceRefinement: "+surfaceRefinement+", volumeRefinement: "+volumeRefinement+", willBeACellZone: "+willBeACellZone);
|
||||
return surfaceRefinement && !volumeRefinement && !willBeACellZone;
|
||||
return surfaceRefinement && !volumeRefinement && !willBeACellZone && !willBeAFaceZone;
|
||||
}
|
||||
|
||||
private boolean isVolumeRefinement(Surface surface) {
|
||||
|
|
@ -248,4 +294,20 @@ public class GeometryToMesh {
|
|||
return naming.getCellZoneName(surface);
|
||||
}
|
||||
|
||||
public String getFaceZoneName(Surface surface) {
|
||||
return naming.getFaceZoneName(surface);
|
||||
}
|
||||
|
||||
public List<Surface> getWillBePatches() {
|
||||
return willBePatches;
|
||||
}
|
||||
|
||||
public List<Surface> getWillBeCellZones() {
|
||||
return willBeCellZones;
|
||||
}
|
||||
|
||||
public List<Surface> getWillBeFaceZones() {
|
||||
return willBeFaceZones;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,31 +1,30 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.controller;
|
||||
|
||||
import static eu.engys.core.project.system.SetFieldsDict.CELL_SET_KEY;
|
||||
import static javax.swing.JOptionPane.ERROR_MESSAGE;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
|
@ -42,24 +41,27 @@ import org.slf4j.LoggerFactory;
|
|||
import com.google.inject.Inject;
|
||||
|
||||
import eu.engys.core.controller.actions.CheckMesh;
|
||||
import eu.engys.core.controller.actions.DecomposeCaseAction;
|
||||
import eu.engys.core.controller.actions.InitialiseFields;
|
||||
import eu.engys.core.controller.actions.RunCommand;
|
||||
import eu.engys.core.controller.actions.StandardInitialiseFields;
|
||||
import eu.engys.core.controller.actions.StandardRunCase;
|
||||
import eu.engys.core.controller.actions.StandardRunMesh;
|
||||
import eu.engys.core.controller.actions.TimeoutException;
|
||||
import eu.engys.core.executor.Executor;
|
||||
import eu.engys.core.executor.TerminalManager;
|
||||
import eu.engys.core.modules.ApplicationModule;
|
||||
import eu.engys.core.parameters.Parameters;
|
||||
import eu.engys.core.presentation.Action;
|
||||
import eu.engys.core.presentation.ActionManager;
|
||||
import eu.engys.core.project.Model;
|
||||
import eu.engys.core.project.ProjectReader;
|
||||
import eu.engys.core.project.ProjectWriter;
|
||||
import eu.engys.core.project.geometry.surface.Stl;
|
||||
import eu.engys.core.project.state.ServerState;
|
||||
import eu.engys.core.project.system.monitoringfunctionobjects.ParserView;
|
||||
import eu.engys.core.project.system.monitoringfunctionobjects.TimeBlocks;
|
||||
import eu.engys.core.project.zero.ZeroFileManager;
|
||||
import eu.engys.core.project.zero.cellzones.CellZonesBuilder;
|
||||
import eu.engys.core.project.zero.fields.Field;
|
||||
import eu.engys.gui.casesetup.fields.StandardInitialisations;
|
||||
import eu.engys.gui.events.EventManager;
|
||||
import eu.engys.gui.events.EventManager.Event;
|
||||
|
|
@ -67,33 +69,53 @@ import eu.engys.gui.events.EventManager.GenericEventListener;
|
|||
import eu.engys.gui.events.application.ApplicationEvent;
|
||||
import eu.engys.gui.events.application.BaseMeshTypeChangedEvent;
|
||||
import eu.engys.gui.events.application.OpenMonitorEvent;
|
||||
import eu.engys.gui.events.view3D.AddSurfaceEvent;
|
||||
import eu.engys.gui.solver.postprocessing.ParsersHandler;
|
||||
import eu.engys.gui.solver.postprocessing.ParsersViewHandler;
|
||||
import eu.engys.gui.solver.postprocessing.panels.residuals.ResidualsView;
|
||||
import eu.engys.parallelworks.CloudPanel;
|
||||
import eu.engys.parallelworks.ParallelWorksClient;
|
||||
import eu.engys.parallelworks.ParallelWorksData;
|
||||
import eu.engys.parallelworks.actions.ParallelWorksInitialiseFields;
|
||||
import eu.engys.parallelworks.actions.ParallelWorksRunCase;
|
||||
import eu.engys.parallelworks.actions.ParallelWorksRunMesh;
|
||||
import eu.engys.util.ApplicationInfo;
|
||||
import eu.engys.util.PrefUtil;
|
||||
import eu.engys.util.progress.ProgressMonitor;
|
||||
import eu.engys.util.progress.SilentMonitor;
|
||||
import eu.engys.util.ui.ScriptEditor;
|
||||
import eu.engys.util.ui.UiUtil;
|
||||
|
||||
public class HelyxOSController extends AbstractController implements GenericEventListener, ParsersManager {
|
||||
|
||||
private static final String PARALLEL_WORKS_RESOURCES_ERROR_TITLE = "Remote Error";
|
||||
private static final String PARALLEL_WORKS_RESOURCES_ERROR_MESSAGE = "No Compute Resources Available - Please Start your Resources on Parallel Works";
|
||||
|
||||
private static final long TIMER_INITIAL_DELAY = 500L;
|
||||
private static final long TIMER_REFRESH_RATE = 1000L;
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(HelyxOSController.class);
|
||||
private ResidualsView residualsView;
|
||||
private ParserView residualsView;
|
||||
private RunCommand command;
|
||||
|
||||
private Timer timer;
|
||||
private ParsersHandler parsersHandler;
|
||||
private ParsersViewHandler viewHandler;
|
||||
private ThreadPoolExecutor executor;
|
||||
private TerminalManager terminalManager;
|
||||
|
||||
@Inject
|
||||
public HelyxOSController(Model model, CellZonesBuilder cellZonesBuilder, Set<ApplicationModule> modules, ProjectReader reader, ProjectWriter writer, CellZonesBuilder zonesBuilder, ProgressMonitor monitor, ScriptFactory scriptFactory) {
|
||||
super(model, modules, reader, writer, zonesBuilder, monitor, scriptFactory);
|
||||
this.residualsView = new ResidualsView(model, monitor);
|
||||
this.residualsView = new ResidualsView(model, modules, monitor);
|
||||
EventManager.registerEventListener(this, ApplicationEvent.class);
|
||||
ActionManager.getInstance().parseActions(this);
|
||||
this.terminalManager = new TerminalManager();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TerminalManager getTerminalManager() {
|
||||
return terminalManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -110,16 +132,25 @@ public class HelyxOSController extends AbstractController implements GenericEven
|
|||
* MESH
|
||||
*/
|
||||
|
||||
@Action(key = "mesh.create", checkEnv = true)
|
||||
@Action(key = MESH_CREATE, checkEnv = true)
|
||||
public void runMesh() {
|
||||
save(model.getProject().getBaseDir());
|
||||
|
||||
command = new StandardRunMesh(model, this, scriptFactory);
|
||||
if (PrefUtil.isRunningOnCloud()) {
|
||||
if (ParallelWorksClient.getInstance().isPoolOn()) {
|
||||
command = new ParallelWorksRunMesh(model, this, scriptFactory, monitor);
|
||||
} else {
|
||||
JOptionPane.showMessageDialog(UiUtil.getActiveWindow(), PARALLEL_WORKS_RESOURCES_ERROR_MESSAGE, PARALLEL_WORKS_RESOURCES_ERROR_TITLE, JOptionPane.ERROR_MESSAGE);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
command = new StandardRunMesh(model, this, scriptFactory);
|
||||
}
|
||||
command.beforeExecute();
|
||||
command.executeClient();
|
||||
}
|
||||
|
||||
@Action(key = "mesh.check", checkEnv = true)
|
||||
@Action(key = MESH_CHECK, checkEnv = true)
|
||||
public void checkMesh() {
|
||||
model.getProject().getSystemFolder().write(model, null);
|
||||
RunCommand checkMesh = new CheckMesh(model, this, scriptFactory);
|
||||
|
|
@ -136,13 +167,13 @@ public class HelyxOSController extends AbstractController implements GenericEven
|
|||
monitor.start("Open " + model.getProject().getBaseDir(), false, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
reopen(OpenOptions.CURRENT_SETTINGS);
|
||||
reopen(OpenMode.CURRENT_SETTINGS);
|
||||
monitor.end();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Action(key = "initialise.fields", checkEnv = true)
|
||||
@Action(key = INITIALISE_SCRIPT, checkEnv = true)
|
||||
public void initialiseFields() {
|
||||
if (model.getProject().getZeroFolder().hasNonZeroTimeFolders()) {
|
||||
int retVal = JOptionPane.showConfirmDialog(UiUtil.getActiveWindow(), "This action will DELETE all the time folders. Continue?", "Initialise Fields", JOptionPane.YES_NO_OPTION);
|
||||
|
|
@ -161,23 +192,46 @@ public class HelyxOSController extends AbstractController implements GenericEven
|
|||
}
|
||||
});
|
||||
|
||||
new StandardInitialisations(model, cellZonesBuilder, modules).initializeFields();
|
||||
if (cellSetFieldPresent()) {
|
||||
StandardInitialisations initialisations = new StandardInitialisations(model, monitor);
|
||||
initialisations.initializeFields();
|
||||
|
||||
model.getProject().getZeroFolder().write(model, cellZonesBuilder, modules, initialisations, new SilentMonitor());
|
||||
if (model.getFields().hasCellSetInitialisationField() || model.getFields().hasPotentialFlowInitialisationField()) {
|
||||
save(model.getProject().getBaseDir());
|
||||
|
||||
command = new StandardInitialiseFields(model, this, scriptFactory);
|
||||
if (PrefUtil.isRunningOnCloud()) {
|
||||
if (ParallelWorksClient.getInstance().isPoolOn()) {
|
||||
JOptionPane.showMessageDialog(UiUtil.getActiveWindow(), PARALLEL_WORKS_RESOURCES_ERROR_MESSAGE, PARALLEL_WORKS_RESOURCES_ERROR_TITLE, ERROR_MESSAGE);
|
||||
command = new ParallelWorksInitialiseFields(model, this, scriptFactory, monitor);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
command = new StandardInitialiseFields(model, this, scriptFactory);
|
||||
}
|
||||
command.beforeExecute();
|
||||
command.executeClient();
|
||||
} else {
|
||||
// just clear polymesh
|
||||
((ZeroFileManager) model.getProject().getZeroFolder().getFileManager()).removeNonZeroDirs("0");
|
||||
}
|
||||
}
|
||||
|
||||
public boolean cellSetFieldPresent() {
|
||||
for (Field f : model.getFields().values()) {
|
||||
if (f.getInitialisationType().equals(CELL_SET_KEY)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
/*
|
||||
* DECOMPOSE
|
||||
*/
|
||||
@Action(key = DECOMPOSE)
|
||||
public void decomposeCase() {
|
||||
new DecomposeCaseAction(model, this, true).executeClient();
|
||||
}
|
||||
|
||||
/*
|
||||
* Parallel Works
|
||||
*/
|
||||
@Action(key = PARALLEL_WORKS)
|
||||
public void openCloud() {
|
||||
new CloudPanel(model, this, monitor).showDialog(ParallelWorksData.fromPrefences());
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -186,7 +240,7 @@ public class HelyxOSController extends AbstractController implements GenericEven
|
|||
|
||||
private void startTimer() {
|
||||
startParsers();
|
||||
viewHandler = new ParsersViewHandler(model, this, residualsView);
|
||||
viewHandler = new ParsersViewHandler(model, modules, this, residualsView);
|
||||
|
||||
executor = Executor.newExecutor("ServerStateMonitor");
|
||||
if (timer == null) {
|
||||
|
|
@ -243,7 +297,18 @@ public class HelyxOSController extends AbstractController implements GenericEven
|
|||
save(model.getProject().getBaseDir());
|
||||
|
||||
listener.beforeRunCase();
|
||||
command = new StandardRunCase(model, this, scriptFactory);
|
||||
|
||||
if (PrefUtil.isRunningOnCloud()) {
|
||||
if (ParallelWorksClient.getInstance().isPoolOn()) {
|
||||
command = new ParallelWorksRunCase(model, this, scriptFactory, monitor);
|
||||
} else {
|
||||
JOptionPane.showMessageDialog(UiUtil.getActiveWindow(), PARALLEL_WORKS_RESOURCES_ERROR_MESSAGE, PARALLEL_WORKS_RESOURCES_ERROR_TITLE, JOptionPane.ERROR_MESSAGE);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
command = new StandardRunCase(model, this, scriptFactory);
|
||||
}
|
||||
|
||||
command.beforeExecute();
|
||||
command.executeClient();
|
||||
|
||||
|
|
@ -252,7 +317,7 @@ public class HelyxOSController extends AbstractController implements GenericEven
|
|||
|
||||
@Action(key = "solver.refresh.once")
|
||||
public void refreshOnce() {
|
||||
ParsersViewHandler viewHandler = new ParsersViewHandler(model, this, residualsView);
|
||||
ParsersViewHandler viewHandler = new ParsersViewHandler(model, modules, this, residualsView);
|
||||
viewHandler.refreshOnce();
|
||||
}
|
||||
|
||||
|
|
@ -274,7 +339,7 @@ public class HelyxOSController extends AbstractController implements GenericEven
|
|||
private void _stopCase() {
|
||||
try {
|
||||
command.stop();
|
||||
} catch (TimeoutException e) {
|
||||
} catch (Exception e) {
|
||||
Object[] options = new Object[] { "Wait", "Kill Process" };
|
||||
int option = JOptionPane.showOptionDialog(monitor.getDialog(), "Solver has not finished yet.\nSelect an action to perform.", "Stop Execution", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[0]);
|
||||
if (timer != null) {
|
||||
|
|
@ -306,26 +371,49 @@ public class HelyxOSController extends AbstractController implements GenericEven
|
|||
command.kill();
|
||||
}
|
||||
|
||||
/*
|
||||
* IMPORT FILES
|
||||
*/
|
||||
@Override
|
||||
protected void importFiles(final File[] stlFiles) {
|
||||
if (stlFiles != null) {
|
||||
monitor.setIndeterminate(false);
|
||||
monitor.start("Loading STL Files", false, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (File file : stlFiles) {
|
||||
Stl stl = model.getGeometry().getFactory().readSTL(file, monitor);
|
||||
model.getGeometry().addSurface(stl);
|
||||
model.geometryChanged(stl);
|
||||
|
||||
EventManager.triggerEvent(this, new AddSurfaceEvent(stl));
|
||||
}
|
||||
monitor.end();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* EDIT SCRIPTS
|
||||
*/
|
||||
|
||||
@Action(key = "solver.run.edit")
|
||||
@Action(key = SOLVER_RUN_EDIT)
|
||||
public void editRunCaseScript() {
|
||||
ScriptEditor.getInstance().show(scriptFactory.getSolverScript(model).toPath(), scriptFactory.getDefaultSolverScript(model));
|
||||
}
|
||||
|
||||
@Action(key = "mesh.create.edit")
|
||||
@Action(key = MESH_CREATE_EDIT)
|
||||
public void editRunMeshScript() {
|
||||
ScriptEditor.getInstance().show(scriptFactory.getMeshScript(model).toPath(), scriptFactory.getDefaultMeshScript(model));
|
||||
}
|
||||
|
||||
@Action(key = "mesh.check.edit")
|
||||
@Action(key = MESH_CHECK_EDIT)
|
||||
public void editCheckMeshScript() {
|
||||
ScriptEditor.getInstance().show(scriptFactory.getCheckMeshScript(model).toPath(), scriptFactory.getDefaultCheckMeshScript(model));
|
||||
}
|
||||
|
||||
@Action(key = "initialise.fields.edit")
|
||||
@Action(key = INITIALISE_SCRIPT_EDIT)
|
||||
public void editInitialiseScript() {
|
||||
ScriptEditor.getInstance().show(scriptFactory.getInitialiseScript(model).toPath(), scriptFactory.getDefaultInitialiseScript(model));
|
||||
}
|
||||
|
|
@ -336,7 +424,7 @@ public class HelyxOSController extends AbstractController implements GenericEven
|
|||
@Override
|
||||
public void startParsers() {
|
||||
logger.info("[SERVER] START PARSERS");
|
||||
parsersHandler = new ParsersHandler(model);
|
||||
parsersHandler = new ParsersHandler(model, modules);
|
||||
parsersHandler.deleteUselessLogFiles();
|
||||
}
|
||||
|
||||
|
|
@ -358,7 +446,7 @@ public class HelyxOSController extends AbstractController implements GenericEven
|
|||
@Override
|
||||
public List<TimeBlocks> updateParserOnce(String foName) {
|
||||
logger.info("[SERVER] UPDATE PARSERS ONCE");
|
||||
ParsersHandler ph = new ParsersHandler(model);
|
||||
ParsersHandler ph = new ParsersHandler(model, modules);
|
||||
return ph.refreshOnceForFunctionObject(foName);
|
||||
}
|
||||
|
||||
|
|
@ -372,8 +460,8 @@ public class HelyxOSController extends AbstractController implements GenericEven
|
|||
}
|
||||
|
||||
@Override
|
||||
public void open(File baseDir) {
|
||||
super.open(baseDir);
|
||||
public void open(OpenOptions oo) {
|
||||
super.open(oo);
|
||||
if (listener != null) {
|
||||
// client.loadState();
|
||||
listener.selectDestinationAndGo();
|
||||
|
|
@ -381,7 +469,7 @@ public class HelyxOSController extends AbstractController implements GenericEven
|
|||
}
|
||||
|
||||
@Override
|
||||
public void reopen(OpenOptions options) {
|
||||
public void reopen(OpenMode options) {
|
||||
if (listener != null) {
|
||||
listener.saveLocation();
|
||||
}
|
||||
|
|
@ -411,18 +499,21 @@ public class HelyxOSController extends AbstractController implements GenericEven
|
|||
}
|
||||
|
||||
@Override
|
||||
protected boolean handleExitOnSolverRunning() {
|
||||
Object[] options = new Object[] { STOP_SOLVER, KILL_SOLVER, CANCEL };
|
||||
int option = JOptionPane.showOptionDialog(UiUtil.getActiveWindow(), "Solver is Running. Select an action to perform.", STOP_SOLVER, JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[0]);
|
||||
protected boolean handleExitOnRunning() {
|
||||
Object[] options = new Object[] { KILL_PROCESS, CANCEL };
|
||||
String message = ApplicationInfo.getName() + " is running. Select an action to perform.";
|
||||
String title = ApplicationInfo.getName();
|
||||
|
||||
int option = JOptionPane.showOptionDialog(UiUtil.getActiveWindow(), message, title, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[0]);
|
||||
if (option == JOptionPane.YES_OPTION) {
|
||||
stopCase();
|
||||
return true;
|
||||
} else if (option == JOptionPane.NO_OPTION) {
|
||||
kill();
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyParameters(Parameters parameters) {
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,28 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.controller;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
|
|
|||
46
src/eu/engys/core/controller/KillCommandOS.java
Normal file
46
src/eu/engys/core/controller/KillCommandOS.java
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.controller;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import eu.engys.util.ui.UiUtil;
|
||||
|
||||
public class KillCommandOS implements Runnable {
|
||||
|
||||
private Controller controller;
|
||||
|
||||
public KillCommandOS(Controller controller) {
|
||||
this.controller = controller;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
int retVal = JOptionPane.showConfirmDialog(UiUtil.getActiveWindow(), "Stop execution?", "Close Monitor", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
|
||||
if (retVal == JOptionPane.YES_OPTION) {
|
||||
controller.kill();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,28 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.controller;
|
||||
|
||||
import java.io.OutputStream;
|
||||
|
|
@ -32,10 +31,6 @@ public interface LogClient extends Serializable {
|
|||
|
||||
void start(String key, OutputStream out, OutputStream err);
|
||||
|
||||
void pump(String key, String lines);
|
||||
|
||||
void close();
|
||||
|
||||
void stop(String key);
|
||||
|
||||
}
|
||||
|
|
|
|||
73
src/eu/engys/core/controller/OpenOptions.java
Normal file
73
src/eu/engys/core/controller/OpenOptions.java
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.controller;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import eu.engys.core.controller.Controller.OpenMode;
|
||||
|
||||
public class OpenOptions {
|
||||
private File file;
|
||||
private File[] filesToImport;
|
||||
private boolean loadMesh;
|
||||
private OpenMode mode;
|
||||
|
||||
public OpenOptions() {
|
||||
}
|
||||
|
||||
private OpenOptions(File file, File[] files, boolean loadMesh, OpenMode mode) {
|
||||
this.file = file;
|
||||
this.filesToImport = files;
|
||||
this.loadMesh = loadMesh;
|
||||
this.mode = mode;
|
||||
}
|
||||
|
||||
public static OpenOptions file(File file, OpenMode mode) {
|
||||
return new OpenOptions(file, null, true, mode);
|
||||
}
|
||||
|
||||
public OpenOptions importFiles(File[] filesToImport) {
|
||||
this.filesToImport = filesToImport;
|
||||
return this;
|
||||
}
|
||||
public OpenOptions loadMesh(boolean loadMesh) {
|
||||
this.loadMesh = loadMesh;
|
||||
return this;
|
||||
}
|
||||
|
||||
public File getFile() {
|
||||
return file;
|
||||
}
|
||||
public OpenMode getMode() {
|
||||
return mode;
|
||||
}
|
||||
public File[] getFilesToImport() {
|
||||
return filesToImport;
|
||||
}
|
||||
public boolean isLoadMesh() {
|
||||
return loadMesh;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,28 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.controller;
|
||||
|
||||
import java.rmi.RemoteException;
|
||||
|
|
|
|||
|
|
@ -1,28 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.controller;
|
||||
|
||||
import java.util.Map;
|
||||
|
|
|
|||
|
|
@ -1,28 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.controller;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
|
|
|||
|
|
@ -1,28 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.controller;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
|
@ -33,7 +32,7 @@ public class ScriptBuilder {
|
|||
private List<String> lines;
|
||||
|
||||
public ScriptBuilder() {
|
||||
lines = new LinkedList<String>();
|
||||
lines = new LinkedList<>();
|
||||
}
|
||||
|
||||
public void append(String s) {
|
||||
|
|
@ -62,4 +61,4 @@ public class ScriptBuilder {
|
|||
return lines;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,28 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
|
||||
package eu.engys.core.controller;
|
||||
|
||||
|
|
@ -39,6 +38,9 @@ public interface ScriptFactory {
|
|||
File getCheckMeshScript(Model model);
|
||||
List<String> getDefaultCheckMeshScript(Model model);
|
||||
|
||||
File getSnappyCheckMeshScript(Model model);
|
||||
List<String> getDefaultSnappyCheckMeshScript(Model model);
|
||||
|
||||
File getSolverScript(Model model);
|
||||
List<String> getDefaultSolverScript(Model model);
|
||||
|
||||
|
|
@ -59,4 +61,7 @@ public interface ScriptFactory {
|
|||
File getExportScript(Model model);
|
||||
List<String> getDefaultExportScript(Model model);
|
||||
|
||||
File getReportScript(Model model);
|
||||
List<String> getDefaultReportScript(Model model);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,28 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.controller;
|
||||
|
||||
import java.rmi.Remote;
|
||||
|
|
@ -58,12 +57,17 @@ public interface Server extends Remote, ParsersManager {
|
|||
|
||||
String test() throws RemoteException;
|
||||
|
||||
void disconnect() throws RemoteException;
|
||||
void clientDisconnect() throws RemoteException;
|
||||
|
||||
QueueInfo getQueueInfo() throws RemoteException;
|
||||
|
||||
void goToBatch() throws RemoteException;
|
||||
CommandInfo goToBatch() throws RemoteException;
|
||||
|
||||
void connect(ClientInfo clientInfo) throws RemoteException;
|
||||
CommandInfo connect(ClientInfo clientInfo) throws RemoteException;
|
||||
|
||||
String getServerID() throws RemoteException;
|
||||
|
||||
boolean isRunningCommand() throws RemoteException;
|
||||
|
||||
ClientInfo getClientInfo() throws RemoteException;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,28 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.controller;
|
||||
|
||||
import java.util.Scanner;
|
||||
|
|
@ -39,7 +38,7 @@ public class ServerInfo {
|
|||
public void decodePorts(String payload) {
|
||||
if (payload != null && !payload.isEmpty()) {
|
||||
Scanner scanner = new Scanner(payload);
|
||||
String date = scanner.hasNextLine() ? scanner.nextLine() : "";
|
||||
this.date = scanner.hasNextLine() ? scanner.nextLine() : "";
|
||||
this.port1 = scanner.hasNextInt() ? scanner.nextInt() : 0;
|
||||
this.port2 = scanner.hasNextInt() ? scanner.nextInt() : 0;
|
||||
scanner.close();
|
||||
|
|
@ -48,6 +47,6 @@ public class ServerInfo {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ServerInfo - ID: " + id + ", msg: " + message + ", port1: " + port1 + ", port2: " + port2 + ", succes: " + success + "date: " + date;
|
||||
return "ServerInfo - ID: " + id + ", msg: " + message + ", port1: " + port1 + ", port2: " + port2 + ", succes: " + success + ", date: " + date;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,28 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.controller;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
|
|
|||
|
|
@ -1,37 +1,35 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.controller;
|
||||
|
||||
import static eu.engys.core.controller.AbstractController.CANCEL;
|
||||
import static eu.engys.core.controller.AbstractController.KILL_SOLVER;
|
||||
import static eu.engys.core.controller.AbstractController.STOP_SOLVER;
|
||||
import static eu.engys.core.controller.AbstractController.KILL_SOLVER_LABEL;
|
||||
import static eu.engys.core.controller.AbstractController.STOP_SOLVER_LABEL;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import eu.engys.core.controller.actions.TimeoutException;
|
||||
import eu.engys.util.ui.UiUtil;
|
||||
|
||||
public class StopOrKillCommandOS implements Runnable {
|
||||
|
|
@ -44,12 +42,12 @@ public class StopOrKillCommandOS implements Runnable {
|
|||
|
||||
@Override
|
||||
public void run() {
|
||||
Object[] options = new Object[] { STOP_SOLVER, KILL_SOLVER, CANCEL };
|
||||
int option = JOptionPane.showOptionDialog(UiUtil.getActiveWindow(), "Select an action to perform.", STOP_SOLVER, JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[0]);
|
||||
Object[] options = new Object[] { STOP_SOLVER_LABEL, KILL_SOLVER_LABEL, CANCEL };
|
||||
int option = JOptionPane.showOptionDialog(UiUtil.getActiveWindow(), "Select an action to perform.", STOP_SOLVER_LABEL, JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[0]);
|
||||
if (option == JOptionPane.YES_OPTION) {
|
||||
try {
|
||||
controller.stopCase();
|
||||
} catch (TimeoutException e) {
|
||||
} catch (Exception e) {
|
||||
// should never pass here
|
||||
}
|
||||
} else if (option == JOptionPane.NO_OPTION) {
|
||||
|
|
|
|||
|
|
@ -1,28 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.controller;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
|
|
|
|||
|
|
@ -1,28 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.controller.actions;
|
||||
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
|
@ -36,11 +35,14 @@ import eu.engys.core.project.Model;
|
|||
public abstract class AbstractRunCommand implements RunCommand {
|
||||
|
||||
protected Model model;
|
||||
protected Executor executor;
|
||||
protected Controller controller;
|
||||
protected Executor executor;
|
||||
|
||||
protected ExecutorService service;
|
||||
protected ExecutorTerminal terminal;
|
||||
|
||||
protected String jobID = null;
|
||||
|
||||
public AbstractRunCommand(Model model, Controller controller) {
|
||||
this.model = model;
|
||||
this.controller = controller;
|
||||
|
|
@ -71,7 +73,7 @@ public abstract class AbstractRunCommand implements RunCommand {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void stop() throws TimeoutException {
|
||||
public void stop() throws Exception {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -83,12 +85,16 @@ public abstract class AbstractRunCommand implements RunCommand {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String executeQueue(Server server) throws CommandException {
|
||||
return null;
|
||||
public void executeQueue(Server server) throws CommandException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void executeBatch() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getJobID() {
|
||||
return jobID;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,28 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.controller.actions;
|
||||
|
||||
import static eu.engys.core.OpenFOAMEnvironment.getEnvironment;
|
||||
|
|
@ -30,17 +29,18 @@ import static eu.engys.core.project.openFOAMProject.LOG;
|
|||
|
||||
import java.io.File;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
import eu.engys.core.controller.Controller;
|
||||
import eu.engys.core.controller.Controller.OpenOptions;
|
||||
import eu.engys.core.controller.ScriptFactory;
|
||||
import eu.engys.core.executor.Executor;
|
||||
import eu.engys.core.executor.ExecutorHook;
|
||||
import eu.engys.core.executor.ExecutorListener.ExecutorState;
|
||||
import eu.engys.core.executor.ExecutorMonitor;
|
||||
import eu.engys.core.executor.ExecutorTerminal;
|
||||
import eu.engys.core.executor.TerminalExecutorMonitor;
|
||||
import eu.engys.core.project.Model;
|
||||
import eu.engys.core.project.mesh.MeshInfoReader;
|
||||
import eu.engys.core.project.mesh.MeshInfoWriter;
|
||||
import eu.engys.util.IOUtils;
|
||||
|
||||
public class CheckMesh extends AbstractRunCommand {
|
||||
|
|
@ -48,39 +48,51 @@ public class CheckMesh extends AbstractRunCommand {
|
|||
public static final String ACTION_NAME = "Check Mesh";
|
||||
public static final String LOG_NAME = "checkMesh.log";
|
||||
|
||||
private File logFile;
|
||||
private ScriptFactory scriptFactory;
|
||||
private String logName;
|
||||
private String actionName;
|
||||
private File logFile;
|
||||
|
||||
public CheckMesh(Model model, Controller controller, ScriptFactory scriptFactory) {
|
||||
this(model, controller, scriptFactory, LOG_NAME, ACTION_NAME);
|
||||
}
|
||||
|
||||
public CheckMesh(Model model, Controller controller, ScriptFactory scriptFactory, String logName, String actionName) {
|
||||
super(model, controller);
|
||||
this.scriptFactory = scriptFactory;
|
||||
this.logFile = Paths.get(model.getProject().getBaseDir().getAbsolutePath(), LOG, LOG_NAME).toFile();
|
||||
this.logName = logName;
|
||||
this.actionName = actionName;
|
||||
this.logFile = Paths.get(model.getProject().getBaseDir().getAbsolutePath(), LOG, logName).toFile();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeExecute() {
|
||||
IOUtils.clearFile(logFile);
|
||||
if (controller.getListener() != null) {
|
||||
controller.getListener().beforeCheckMesh();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void executeClient() {
|
||||
ExecutorTerminal terminal = new TerminalExecutorMonitor(logFile);
|
||||
if (terminal == null) {
|
||||
this.terminal = new TerminalExecutorMonitor(controller.getTerminalManager(), logFile);
|
||||
}
|
||||
if (service == null) {
|
||||
this.service = Executors.newSingleThreadExecutor();
|
||||
}
|
||||
|
||||
ExecutorMonitor monitor = new ExecutorMonitor();
|
||||
monitor.addHook(ExecutorState.FINISH, new FinishHook());
|
||||
|
||||
this.executor = Executor.script(scriptFactory.getCheckMeshScript(model)).description(ACTION_NAME).inFolder(model.getProject().getBaseDir()).inTerminal(terminal).withMonitors(monitor).env(getEnvironment(model, LOG_NAME)).keepFileOnEnd();
|
||||
this.executor = Executor.script(scriptFactory.getCheckMeshScript(model)).description(actionName).inFolder(model.getProject().getBaseDir()).inTerminal(terminal).withMonitors(monitor).inService(service).env(getEnvironment(model, logName)).keepFileOnEnd();
|
||||
executor.exec();
|
||||
}
|
||||
|
||||
private class FinishHook implements ExecutorHook {
|
||||
|
||||
@Override
|
||||
public void run(ExecutorMonitor monitor) {
|
||||
if (controller.getListener() != null) {
|
||||
controller.reopenCase(OpenOptions.MESH_ONLY);
|
||||
new MeshInfoReader(model).read(logFile);
|
||||
new MeshInfoWriter(model).write();
|
||||
model.getProject().getSystemFolder().writeProjectDict(null);
|
||||
controller.getListener().afterCheckMesh();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,28 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.controller.actions;
|
||||
|
||||
public class CommandException extends Exception {
|
||||
|
|
@ -31,4 +30,8 @@ public class CommandException extends Exception {
|
|||
super(message);
|
||||
}
|
||||
|
||||
public CommandException(String message, Exception e) {
|
||||
super(message, e);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,29 +1,28 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
package eu.engys.gui.casesetup.actions;
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.controller.actions;
|
||||
|
||||
import static eu.engys.core.OpenFOAMEnvironment.getEnvironment;
|
||||
import static eu.engys.core.OpenFOAMEnvironment.loadEnvironment;
|
||||
|
|
@ -37,12 +36,12 @@ import static eu.engys.util.OpenFOAMCommands.DECOMPOSE_PAR_CONSTANT_ALLREGIONS;
|
|||
|
||||
import java.io.File;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
import eu.engys.core.controller.Controller;
|
||||
import eu.engys.core.controller.Controller.OpenOptions;
|
||||
import eu.engys.core.controller.Controller.OpenMode;
|
||||
import eu.engys.core.controller.ScriptBuilder;
|
||||
import eu.engys.core.controller.actions.AbstractRunCommand;
|
||||
import eu.engys.core.executor.Executor;
|
||||
import eu.engys.core.executor.ExecutorHook;
|
||||
import eu.engys.core.executor.ExecutorListener.ExecutorState;
|
||||
|
|
@ -54,19 +53,23 @@ import eu.engys.util.Util;
|
|||
|
||||
public class DecomposeCase extends AbstractRunCommand {
|
||||
|
||||
public static final String ACTION_NAME = "Decompose";
|
||||
private static final String DECOMPOSE_RUN = "decomposeCase.run";
|
||||
private static final String DECOMPOSE_BAT = "decomposeCase.bat";
|
||||
|
||||
private File logFile;
|
||||
private String actionName;
|
||||
private String logName;
|
||||
private Set<String> timeSteps;
|
||||
|
||||
public DecomposeCase(Model model, Controller controller, String actionName, String logName) {
|
||||
public DecomposeCase(Model model, Controller controller, String logName, String actionName, Set<String> timeSteps) {
|
||||
super(model, controller);
|
||||
this.actionName = actionName;
|
||||
this.logName = logName;
|
||||
this.timeSteps = timeSteps;
|
||||
this.logFile = Paths.get(model.getProject().getBaseDir().getAbsolutePath(), LOG, logName).toFile();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void beforeExecute() {
|
||||
|
|
@ -79,7 +82,7 @@ public class DecomposeCase extends AbstractRunCommand {
|
|||
File baseDir = model.getProject().getBaseDir();
|
||||
|
||||
if (terminal == null) {
|
||||
this.terminal = new TerminalExecutorMonitor(logFile);
|
||||
this.terminal = new TerminalExecutorMonitor(controller.getTerminalManager(), logFile);
|
||||
}
|
||||
if (service == null) {
|
||||
this.service = Executors.newSingleThreadExecutor();
|
||||
|
|
@ -104,7 +107,7 @@ public class DecomposeCase extends AbstractRunCommand {
|
|||
}
|
||||
|
||||
private void writeScript(ScriptBuilder sb) {
|
||||
printHeader(sb, actionName.toUpperCase());
|
||||
printHeader(sb, ACTION_NAME);
|
||||
printVariables(sb);
|
||||
loadEnvironment(sb);
|
||||
writeCommand(sb);
|
||||
|
|
@ -113,15 +116,15 @@ public class DecomposeCase extends AbstractRunCommand {
|
|||
private void writeCommand(ScriptBuilder sb) {
|
||||
if (model.getProject().isMeshOnZero() || model.getProject().isSerial()) {
|
||||
if (model.getProject().getZeroFolder().hasRegions()) {
|
||||
sb.append(DECOMPOSE_PAR_ALLREGIONS());
|
||||
sb.append(DECOMPOSE_PAR_ALLREGIONS(timeSteps));
|
||||
} else {
|
||||
sb.append(DECOMPOSE_PAR());
|
||||
sb.append(DECOMPOSE_PAR(timeSteps));
|
||||
}
|
||||
} else {
|
||||
if (model.getProject().getZeroFolder().hasRegions()) {
|
||||
sb.append(DECOMPOSE_PAR_CONSTANT_ALLREGIONS());
|
||||
sb.append(DECOMPOSE_PAR_CONSTANT_ALLREGIONS(timeSteps));
|
||||
} else {
|
||||
sb.append(DECOMPOSE_PAR_CONSTANT());
|
||||
sb.append(DECOMPOSE_PAR_CONSTANT(timeSteps));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -131,7 +134,7 @@ public class DecomposeCase extends AbstractRunCommand {
|
|||
@Override
|
||||
public void run(ExecutorMonitor monitor) {
|
||||
if (controller.getListener() != null) {
|
||||
controller.reopenCase(OpenOptions.PARALLEL);
|
||||
controller.reopenCase(OpenMode.PARALLEL);
|
||||
}
|
||||
}
|
||||
}
|
||||
105
src/eu/engys/core/controller/actions/DecomposeCaseAction.java
Normal file
105
src/eu/engys/core/controller/actions/DecomposeCaseAction.java
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.controller.actions;
|
||||
|
||||
import static eu.engys.core.controller.actions.DecomposeCase.ACTION_NAME;
|
||||
import static eu.engys.core.project.openFOAMProject.LOG;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
import eu.engys.core.controller.Controller;
|
||||
import eu.engys.core.executor.TerminalExecutorMonitor;
|
||||
import eu.engys.core.project.Model;
|
||||
import eu.engys.util.IOUtils;
|
||||
|
||||
public class DecomposeCaseAction extends AbstractRunCommand {
|
||||
|
||||
public static final String LOG_NAME = "decomposeCase.log";
|
||||
|
||||
private Model model;
|
||||
private Controller controller;
|
||||
|
||||
private boolean shouldUseWithZeroFlag;
|
||||
|
||||
public DecomposeCaseAction(Model model, Controller controller, boolean shouldUseWithZeroFlag) {
|
||||
super(model, controller);
|
||||
this.model = model;
|
||||
this.controller = controller;
|
||||
this.shouldUseWithZeroFlag = shouldUseWithZeroFlag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void executeClient() {
|
||||
DecomposeCasePanel panel = new DecomposeCasePanel(model);
|
||||
panel.showDialog();
|
||||
if (panel.getStatus().isOK()) {
|
||||
controller.saveCase(model.getProject().getBaseDir());
|
||||
decompose(panel.getTimeSteps());
|
||||
}
|
||||
}
|
||||
|
||||
private void decompose(Set<String> timeSteps) {
|
||||
if (model.getProject().isParallel()) {
|
||||
decomposeParallelCase(timeSteps);
|
||||
} else {
|
||||
decomposeSerialCase(timeSteps);
|
||||
}
|
||||
}
|
||||
|
||||
private void decomposeSerialCase(Set<String> timeSteps) {
|
||||
RunCommand command = new DecomposeCase(model, controller, LOG_NAME, ACTION_NAME, timeSteps);
|
||||
command.beforeExecute();
|
||||
command.executeClient();
|
||||
}
|
||||
|
||||
private void decomposeParallelCase(Set<String> timeSteps) {
|
||||
File logFile = Paths.get(model.getProject().getBaseDir().getAbsolutePath(), LOG, LOG_NAME).toFile();
|
||||
|
||||
IOUtils.clearFile(logFile);
|
||||
|
||||
TerminalExecutorMonitor terminal = new TerminalExecutorMonitor(controller.getTerminalManager(), logFile);
|
||||
ExecutorService service = Executors.newSingleThreadExecutor();
|
||||
|
||||
RunCommand reconstructMesh = new ReconstructMesh(model, controller, ACTION_NAME, LOG_NAME);
|
||||
reconstructMesh.inService(service);
|
||||
reconstructMesh.inTerminal(terminal);
|
||||
reconstructMesh.executeClient();
|
||||
|
||||
RunCommand reconstructCase = new ReconstructCase(model, controller, shouldUseWithZeroFlag, ACTION_NAME, LOG_NAME);
|
||||
reconstructCase.inService(service);
|
||||
reconstructCase.inTerminal(terminal);
|
||||
reconstructCase.executeClient();
|
||||
|
||||
RunCommand decomposeCase = new DecomposeCase(model, controller, LOG_NAME, ACTION_NAME, timeSteps);
|
||||
decomposeCase.inService(service);
|
||||
decomposeCase.inTerminal(terminal);
|
||||
decomposeCase.executeClient();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,29 +1,28 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
package eu.engys.gui.casesetup.actions;
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.controller.actions;
|
||||
|
||||
import static eu.engys.core.project.system.DecomposeParDict.DELTA_KEY;
|
||||
import static eu.engys.core.project.system.DecomposeParDict.HIERARCHICAL_COEFFS_KEY;
|
||||
|
|
@ -36,21 +35,34 @@ import static eu.engys.core.project.system.DecomposeParDict.SCOTCH_KEY;
|
|||
import static eu.engys.core.project.system.DecomposeParDict.TYPE_KEYS;
|
||||
import static eu.engys.core.project.system.DecomposeParDict.YXZ_KEY;
|
||||
import static eu.engys.util.ui.ComponentsFactory.labelArrayField;
|
||||
import static eu.engys.util.ui.UiUtil.DIALOG_CANCEL_LABEL;
|
||||
import static eu.engys.util.ui.UiUtil.DIALOG_OK_LABEL;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.GridLayout;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.io.File;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
|
||||
import eu.engys.core.dictionary.Dictionary;
|
||||
import eu.engys.core.dictionary.model.DictionaryModel;
|
||||
|
|
@ -67,10 +79,16 @@ public class DecomposeCasePanel extends JPanel {
|
|||
public static final String HIERARCHY_LABEL = "Hierarchy";
|
||||
public static final String PROCESSORS_LABEL = "Processors";
|
||||
public static final String DECOMPOSITION_TYPE_LABEL = "Decomposition Type";
|
||||
public static final String TIME_STEP = "Time Steps";
|
||||
|
||||
public static final String HIERARCHICAL_LABEL = "Hierarchical";
|
||||
public static final String SCOTCH_LABEL = "Scotch";
|
||||
private static final String[] TYPE_LABELS = { HIERARCHICAL_LABEL, SCOTCH_LABEL };
|
||||
private static final String SELECT_ALL = "Select All";
|
||||
private static final String DESELECT_ALL = "Deselect All";
|
||||
public static final String DECOMPOSE_PANEL = "decompose.panel";
|
||||
|
||||
private Map<JCheckBox, String> timeStepMap;
|
||||
|
||||
public enum Status {
|
||||
OK, CANCEL;
|
||||
|
|
@ -103,10 +121,11 @@ public class DecomposeCasePanel extends JPanel {
|
|||
|
||||
public DecomposeCasePanel(Model model) {
|
||||
super(new BorderLayout());
|
||||
setName("decompose.panel");
|
||||
setName(DECOMPOSE_PANEL);
|
||||
this.model = model;
|
||||
this.mainModel = new DictionaryModel();
|
||||
this.hierarchicalDictionaryModel = new DictionaryModel();
|
||||
this.timeStepMap = new HashMap<>();
|
||||
layoutComponents();
|
||||
}
|
||||
|
||||
|
|
@ -146,7 +165,49 @@ public class DecomposeCasePanel extends JPanel {
|
|||
nProcessorsField.addPropertyChangeListener(new RecalculateFactorsOnChange());
|
||||
nProcessorsField.setIntValue(1);
|
||||
|
||||
add(builder.getPanel());
|
||||
add(builder.getPanel(), BorderLayout.CENTER);
|
||||
add(createTimeStepsPanel(), BorderLayout.SOUTH);
|
||||
}
|
||||
|
||||
private JComponent createTimeStepsPanel() {
|
||||
JPanel panel = new JPanel(new GridLayout(0, 4));
|
||||
|
||||
File[] zeroDirs = model.getProject().getZeroFolder().getFileManager().getZeroDirs("0");
|
||||
File[] nonZeroDirs = model.getProject().getZeroFolder().getFileManager().getNonZeroDirs("0");
|
||||
|
||||
Set<String> timeSteps = new TreeSet<>(new Comparator<String>() {
|
||||
@Override
|
||||
public int compare(String o1, String o2) {
|
||||
return Double.valueOf(o1).compareTo(Double.valueOf(o2));
|
||||
}
|
||||
});
|
||||
for (File zeroDir : zeroDirs) {
|
||||
timeSteps.add(zeroDir.getName());
|
||||
}
|
||||
for (File nonZeroDir : nonZeroDirs) {
|
||||
timeSteps.add(nonZeroDir.getName());
|
||||
}
|
||||
|
||||
for (String timeStep : timeSteps) {
|
||||
JCheckBox chk = new JCheckBox(timeStep, true);
|
||||
timeStepMap.put(chk, timeStep);
|
||||
chk.setName(timeStep);
|
||||
panel.add(chk);
|
||||
}
|
||||
|
||||
panel.setBorder(BorderFactory.createTitledBorder(TIME_STEP));
|
||||
panel.setName(TIME_STEP);
|
||||
return panel;
|
||||
}
|
||||
|
||||
public Set<String> getTimeSteps() {
|
||||
Set<String> timeSteps = new TreeSet<>();
|
||||
for (JCheckBox check : timeStepMap.keySet()){
|
||||
if(check.isSelected()){
|
||||
timeSteps.add(timeStepMap.get(check));
|
||||
}
|
||||
}
|
||||
return timeSteps;
|
||||
}
|
||||
|
||||
public void showDialog() {
|
||||
|
|
@ -158,9 +219,9 @@ public class DecomposeCasePanel extends JPanel {
|
|||
private void createDialog() {
|
||||
if (dialog == null) {
|
||||
dialog = new JDialog(UiUtil.getActiveWindow(), DECOMPOSE_CASE_LABEL);
|
||||
dialog.setName("create.case.dialog");
|
||||
dialog.setName(DECOMPOSE_PANEL);
|
||||
|
||||
AbstractAction saveAndCloseDialogAction = new AbstractAction("OK") {
|
||||
AbstractAction saveAndCloseDialogAction = new AbstractAction(DIALOG_OK_LABEL) {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (TYPE_KEYS[0].equals(decompositionType.getSelectedItem()) && !productEqualsToNumberOfSubdomain()) {
|
||||
|
|
@ -173,7 +234,7 @@ public class DecomposeCasePanel extends JPanel {
|
|||
}
|
||||
};
|
||||
|
||||
final AbstractAction cancelAction = new AbstractAction("Cancel") {
|
||||
final AbstractAction cancelAction = new AbstractAction(DIALOG_CANCEL_LABEL) {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
status = Status.CANCEL;
|
||||
|
|
@ -182,26 +243,20 @@ public class DecomposeCasePanel extends JPanel {
|
|||
dialog = null;
|
||||
}
|
||||
};
|
||||
|
||||
JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
|
||||
|
||||
JButton okButton = new JButton(saveAndCloseDialogAction);
|
||||
okButton.setName("OK");
|
||||
buttonsPanel.add(okButton);
|
||||
|
||||
JButton cancelButton = new JButton(cancelAction);
|
||||
cancelButton.setName("Cancel");
|
||||
buttonsPanel.add(cancelButton);
|
||||
|
||||
|
||||
JPanel buttonsPanel = createButtonsPanel(saveAndCloseDialogAction, cancelAction);
|
||||
|
||||
JScrollPane pane = new JScrollPane(this);
|
||||
pane.setBorder(BorderFactory.createEmptyBorder());
|
||||
|
||||
JPanel mainPanel = new JPanel(new BorderLayout());
|
||||
mainPanel.add(this, BorderLayout.CENTER);
|
||||
mainPanel.add(pane, BorderLayout.CENTER);
|
||||
mainPanel.add(buttonsPanel, BorderLayout.SOUTH);
|
||||
|
||||
dialog.add(mainPanel);
|
||||
dialog.setSize(350, 200);
|
||||
dialog.setSize(400, 300);
|
||||
dialog.setLocationRelativeTo(null);
|
||||
dialog.setModal(true);
|
||||
dialog.getRootPane().setDefaultButton(okButton);
|
||||
|
||||
dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
|
||||
dialog.addWindowListener(new WindowAdapter() {
|
||||
|
|
@ -213,6 +268,44 @@ public class DecomposeCasePanel extends JPanel {
|
|||
}
|
||||
}
|
||||
|
||||
private JPanel createButtonsPanel(AbstractAction saveAndCloseDialogAction, AbstractAction cancelAction) {
|
||||
JPanel rightButtonsPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
|
||||
JButton okButton = new JButton(saveAndCloseDialogAction);
|
||||
okButton.setName(DIALOG_OK_LABEL);
|
||||
JButton cancelButton = new JButton(cancelAction);
|
||||
cancelButton.setName(DIALOG_CANCEL_LABEL);
|
||||
rightButtonsPanel.add(okButton);
|
||||
rightButtonsPanel.add(cancelButton);
|
||||
|
||||
JPanel leftButtonsPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||
JButton selectAll = new JButton(new AbstractAction(SELECT_ALL) {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
for (JCheckBox chk : timeStepMap.keySet()) {
|
||||
chk.setSelected(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
JButton deselectAll = new JButton(new AbstractAction(DESELECT_ALL) {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
for (JCheckBox chk : timeStepMap.keySet()) {
|
||||
chk.setSelected(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
leftButtonsPanel.add(selectAll);
|
||||
leftButtonsPanel.add(deselectAll);
|
||||
|
||||
JPanel buttonsPanel = new JPanel(new GridLayout(1, 2));
|
||||
buttonsPanel.add(leftButtonsPanel);
|
||||
buttonsPanel.add(rightButtonsPanel);
|
||||
|
||||
return buttonsPanel;
|
||||
}
|
||||
|
||||
private boolean productEqualsToNumberOfSubdomain() {
|
||||
int nOfSubdomains = nProcessorsField.getIntValue();
|
||||
int x = nHierarchyField[X].getIntValue();
|
||||
|
|
@ -1,28 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.controller.actions;
|
||||
|
||||
import eu.engys.core.controller.Controller;
|
||||
|
|
|
|||
|
|
@ -1,28 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.controller.actions;
|
||||
|
||||
import static eu.engys.core.project.openFOAMProject.LOG;
|
||||
|
|
|
|||
|
|
@ -1,28 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.controller.actions;
|
||||
|
||||
import eu.engys.core.project.geometry.Surface;
|
||||
|
|
@ -32,4 +31,6 @@ public interface NamingConvention {
|
|||
String getPatchName(Surface surface);
|
||||
|
||||
String getCellZoneName(Surface surface);
|
||||
|
||||
String getFaceZoneName(Surface surface);
|
||||
}
|
||||
|
|
|
|||
107
src/eu/engys/core/controller/actions/ReconstructCase.java
Normal file
107
src/eu/engys/core/controller/actions/ReconstructCase.java
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.controller.actions;
|
||||
|
||||
import static eu.engys.core.OpenFOAMEnvironment.getEnvironment;
|
||||
import static eu.engys.core.OpenFOAMEnvironment.loadEnvironment;
|
||||
import static eu.engys.core.OpenFOAMEnvironment.printHeader;
|
||||
import static eu.engys.core.OpenFOAMEnvironment.printVariables;
|
||||
import static eu.engys.core.project.openFOAMProject.LOG;
|
||||
import static eu.engys.util.OpenFOAMCommands.RECONSTRUCT_PAR;
|
||||
import static eu.engys.util.OpenFOAMCommands.RECONSTRUCT_PAR_ALLREGIONS;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
import eu.engys.core.controller.Controller;
|
||||
import eu.engys.core.controller.ScriptBuilder;
|
||||
import eu.engys.core.executor.Executor;
|
||||
import eu.engys.core.executor.TerminalExecutorMonitor;
|
||||
import eu.engys.core.project.Model;
|
||||
import eu.engys.util.IOUtils;
|
||||
import eu.engys.util.Util;
|
||||
|
||||
public class ReconstructCase extends AbstractRunCommand {
|
||||
|
||||
public static final String ACTION_NAME = "Reconstruct Par";
|
||||
private static final String RECONSTRUCT_CASE_RUN = "reconstructCase.run";
|
||||
private static final String RECONSTRUCT_CASE_BAT = "reconstructCase.bat";
|
||||
|
||||
private String actionName;
|
||||
private String logName;
|
||||
private File logFile;
|
||||
private boolean shouldUseWithZeroFlag;
|
||||
|
||||
public ReconstructCase(Model model, Controller controller, boolean shouldUseWithZeroFlag, String actionName, String logName) {
|
||||
super(model, controller);
|
||||
this.shouldUseWithZeroFlag = shouldUseWithZeroFlag;
|
||||
this.actionName = actionName;
|
||||
this.logName = logName;
|
||||
this.logFile = Paths.get(model.getProject().getBaseDir().getAbsolutePath(), LOG, logName).toFile();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void executeClient() {
|
||||
File script = getScript();
|
||||
File baseDir = model.getProject().getBaseDir();
|
||||
|
||||
if (terminal == null) {
|
||||
this.terminal = new TerminalExecutorMonitor(controller.getTerminalManager(), logFile);
|
||||
}
|
||||
if (service == null) {
|
||||
this.service = Executors.newSingleThreadExecutor();
|
||||
}
|
||||
|
||||
this.executor = Executor.script(script).description(actionName).inFolder(baseDir).inTerminal(terminal).inService(service).env(getEnvironment(model, logName));
|
||||
executor.exec();
|
||||
}
|
||||
|
||||
private File getScript() {
|
||||
File file = new File(model.getProject().getBaseDir(), Util.isWindows() ? RECONSTRUCT_CASE_BAT : RECONSTRUCT_CASE_RUN);
|
||||
ScriptBuilder sb = new ScriptBuilder();
|
||||
writeScript(sb);
|
||||
IOUtils.writeLinesToFile(file, sb.getLines());
|
||||
file.setExecutable(true);
|
||||
return file;
|
||||
}
|
||||
|
||||
private void writeScript(ScriptBuilder sb) {
|
||||
printHeader(sb, ACTION_NAME);
|
||||
printVariables(sb);
|
||||
loadEnvironment(sb);
|
||||
writeCommand(sb);
|
||||
}
|
||||
|
||||
private void writeCommand(ScriptBuilder sb) {
|
||||
if (model.getProject().getZeroFolder().hasRegions()) {
|
||||
sb.append(RECONSTRUCT_PAR_ALLREGIONS(shouldUseWithZeroFlag));
|
||||
} else {
|
||||
sb.append(RECONSTRUCT_PAR(shouldUseWithZeroFlag));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
116
src/eu/engys/core/controller/actions/ReconstructMesh.java
Normal file
116
src/eu/engys/core/controller/actions/ReconstructMesh.java
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.controller.actions;
|
||||
|
||||
import static eu.engys.core.OpenFOAMEnvironment.getEnvironment;
|
||||
import static eu.engys.core.OpenFOAMEnvironment.loadEnvironment;
|
||||
import static eu.engys.core.OpenFOAMEnvironment.printHeader;
|
||||
import static eu.engys.core.OpenFOAMEnvironment.printVariables;
|
||||
import static eu.engys.core.project.openFOAMProject.LOG;
|
||||
import static eu.engys.util.OpenFOAMCommands.RECONSTRUCT_PAR_MESH;
|
||||
import static eu.engys.util.OpenFOAMCommands.RECONSTRUCT_PAR_MESH_ALLREGIONS;
|
||||
import static eu.engys.util.OpenFOAMCommands.RECONSTRUCT_PAR_MESH_CONSTANT;
|
||||
import static eu.engys.util.OpenFOAMCommands.RECONSTRUCT_PAR_MESH_CONSTANT_ALLREGIONS;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
import eu.engys.core.controller.Controller;
|
||||
import eu.engys.core.controller.ScriptBuilder;
|
||||
import eu.engys.core.executor.Executor;
|
||||
import eu.engys.core.executor.TerminalExecutorMonitor;
|
||||
import eu.engys.core.project.Model;
|
||||
import eu.engys.util.IOUtils;
|
||||
import eu.engys.util.Util;
|
||||
|
||||
public class ReconstructMesh extends AbstractRunCommand {
|
||||
|
||||
public static final String ACTION_NAME = "Reconstruct Par Mesh";
|
||||
private static final String RECONSTRUCT_MESH_RUN = "reconstructMesh.run";
|
||||
private static final String RECONSTRUCT_MESH_BAT = "reconstructMesh.bat";
|
||||
|
||||
private String actionName;
|
||||
private String logName;
|
||||
private File logFile;
|
||||
|
||||
public ReconstructMesh(Model model, Controller controller, String actionName, String logName) {
|
||||
super(model, controller);
|
||||
this.actionName = actionName;
|
||||
this.logName = logName;
|
||||
this.logFile = Paths.get(model.getProject().getBaseDir().getAbsolutePath(), LOG, logName).toFile();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void executeClient() {
|
||||
File script = getScript();
|
||||
File baseDir = model.getProject().getBaseDir();
|
||||
|
||||
if (terminal == null) {
|
||||
this.terminal = new TerminalExecutorMonitor(controller.getTerminalManager(), logFile);
|
||||
}
|
||||
if (service == null) {
|
||||
this.service = Executors.newSingleThreadExecutor();
|
||||
}
|
||||
|
||||
this.executor = Executor.script(script).description(actionName).inFolder(baseDir).inTerminal(terminal).inService(service).env(getEnvironment(model, logName));
|
||||
executor.exec();
|
||||
}
|
||||
|
||||
private File getScript() {
|
||||
File file = new File(model.getProject().getBaseDir(), Util.isWindows() ? RECONSTRUCT_MESH_BAT : RECONSTRUCT_MESH_RUN);
|
||||
ScriptBuilder sb = new ScriptBuilder();
|
||||
writeScript(sb);
|
||||
IOUtils.writeLinesToFile(file, sb.getLines());
|
||||
file.setExecutable(true);
|
||||
return file;
|
||||
}
|
||||
|
||||
private void writeScript(ScriptBuilder sb) {
|
||||
printHeader(sb, ACTION_NAME);
|
||||
printVariables(sb);
|
||||
loadEnvironment(sb);
|
||||
writeCommand(sb);
|
||||
}
|
||||
|
||||
private void writeCommand(ScriptBuilder sb) {
|
||||
boolean meshOnZero = model.getProject().isMeshOnZero();
|
||||
|
||||
if (meshOnZero) {
|
||||
if (model.getProject().getZeroFolder().hasRegions()) {
|
||||
sb.append(RECONSTRUCT_PAR_MESH_ALLREGIONS());
|
||||
} else {
|
||||
sb.append(RECONSTRUCT_PAR_MESH());
|
||||
}
|
||||
} else {
|
||||
if (model.getProject().getZeroFolder().hasRegions()) {
|
||||
sb.append(RECONSTRUCT_PAR_MESH_CONSTANT_ALLREGIONS());
|
||||
} else {
|
||||
sb.append(RECONSTRUCT_PAR_MESH_CONSTANT());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,57 +1,43 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.controller.actions;
|
||||
|
||||
import static eu.engys.core.project.system.ControlDict.CONTROL_DICT;
|
||||
import static eu.engys.core.project.system.ControlDict.END_TIME_KEY;
|
||||
import static eu.engys.core.project.system.ControlDict.STOP_AT_KEY;
|
||||
import static eu.engys.core.project.system.ControlDict.WRITE_NOW_KEY;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import eu.engys.core.controller.Command;
|
||||
import eu.engys.core.controller.Controller;
|
||||
import eu.engys.core.controller.ScriptFactory;
|
||||
import eu.engys.core.dictionary.DictionaryUtils;
|
||||
import eu.engys.core.executor.ExecutorHook;
|
||||
import eu.engys.core.executor.ExecutorMonitor;
|
||||
import eu.engys.core.project.Model;
|
||||
import eu.engys.core.project.SolverState;
|
||||
import eu.engys.core.project.openFOAMProject;
|
||||
import eu.engys.core.project.state.ServerState;
|
||||
import eu.engys.core.project.system.ControlDict;
|
||||
import eu.engys.util.PrefUtil;
|
||||
|
||||
public class RunCase extends AbstractRunCommand {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(RunCase.class);
|
||||
|
||||
public static final String ACTION_NAME = "Run Case";
|
||||
public static final String RUNNING_LABEL = "Running: ";
|
||||
|
||||
|
|
@ -67,7 +53,8 @@ public class RunCase extends AbstractRunCommand {
|
|||
setupLogFolder();
|
||||
setupPostProcFolder();
|
||||
clearPolyMesh();
|
||||
setStopAtVariableToEndTime();
|
||||
|
||||
new Stopper(model, executor).setStopAtVariableToEndTime();
|
||||
}
|
||||
|
||||
private void setupLogFolder() {
|
||||
|
|
@ -87,41 +74,8 @@ public class RunCase extends AbstractRunCommand {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void stop() throws TimeoutException {
|
||||
int stop_refresh_time = PrefUtil.getInt(PrefUtil.SERVER_CONNECTION_REFRESH_TIME, 1000);
|
||||
int stop_max_tries = PrefUtil.getInt(PrefUtil.SERVER_CONNECTION_MAX_TRIES, 60);
|
||||
|
||||
int tryIndex = 0;
|
||||
while (this.executor.getState().isDoingSomething() && (tryIndex < stop_max_tries)) {
|
||||
try {
|
||||
Thread.sleep(stop_refresh_time);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
setStopAtVariableToWriteNow();
|
||||
tryIndex++;
|
||||
}
|
||||
if (tryIndex >= stop_max_tries) {
|
||||
throw new TimeoutException("Timeout stopping solver");
|
||||
}
|
||||
setStopAtVariableToEndTime();
|
||||
}
|
||||
|
||||
private void setStopAtVariableToWriteNow() {
|
||||
File systemFolder = model.getProject().getSystemFolder().getFileManager().getFile();
|
||||
ControlDict controlDict = new ControlDict(new File(systemFolder, CONTROL_DICT));
|
||||
controlDict.add(STOP_AT_KEY, WRITE_NOW_KEY);
|
||||
controlDict.functionObjectsToList();
|
||||
DictionaryUtils.writeDictionary(systemFolder, controlDict, null);
|
||||
}
|
||||
|
||||
private void setStopAtVariableToEndTime() {
|
||||
File systemFolder = model.getProject().getSystemFolder().getFileManager().getFile();
|
||||
ControlDict controlDict = new ControlDict(new File(systemFolder, CONTROL_DICT));
|
||||
if (controlDict.found(STOP_AT_KEY) && controlDict.lookup(STOP_AT_KEY).equals(WRITE_NOW_KEY)) {
|
||||
controlDict.add(STOP_AT_KEY, END_TIME_KEY);
|
||||
controlDict.functionObjectsToList();
|
||||
DictionaryUtils.writeDictionary(systemFolder, controlDict, null);
|
||||
}
|
||||
public void stop() throws Exception {
|
||||
new Stopper(model, executor).stop();
|
||||
}
|
||||
|
||||
protected class StartHook implements ExecutorHook {
|
||||
|
|
|
|||
|
|
@ -1,28 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.controller.actions;
|
||||
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
|
@ -40,9 +39,9 @@ public interface RunCommand {
|
|||
|
||||
public void executeServer(Server server) throws CommandException;
|
||||
|
||||
public String executeQueue(Server server) throws CommandException;
|
||||
public void executeQueue(Server server) throws CommandException;
|
||||
|
||||
public void stop() throws TimeoutException;
|
||||
public void stop() throws Exception;
|
||||
|
||||
public void kill();
|
||||
|
||||
|
|
@ -52,4 +51,5 @@ public interface RunCommand {
|
|||
|
||||
public boolean isRunning();
|
||||
|
||||
public String getJobID();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,28 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.controller.actions;
|
||||
|
||||
import static eu.engys.core.project.openFOAMProject.LOG;
|
||||
|
|
@ -42,6 +41,7 @@ public class RunMesh extends AbstractRunCommand {
|
|||
public static final String LOG_NAME = "snappyHexMesh.log";
|
||||
|
||||
protected final ScriptFactory scriptFactory;
|
||||
protected File logFile;
|
||||
|
||||
public RunMesh(Model model, Controller controller, ScriptFactory scriptFactory) {
|
||||
super(model, controller);
|
||||
|
|
@ -50,7 +50,8 @@ public class RunMesh extends AbstractRunCommand {
|
|||
|
||||
@Override
|
||||
public void beforeExecute() {
|
||||
IOUtils.clearFile(Paths.get(model.getProject().getBaseDir().getAbsolutePath(), LOG, LOG_NAME).toFile());
|
||||
this.logFile = Paths.get(model.getProject().getBaseDir().getAbsolutePath(), LOG, LOG_NAME).toFile();
|
||||
IOUtils.clearFile(logFile);
|
||||
clearPolyMesh();
|
||||
setupLogFolder();
|
||||
fixDecomposeParDict(model);
|
||||
|
|
|
|||
|
|
@ -1,50 +1,55 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.controller.actions;
|
||||
|
||||
import static eu.engys.core.OpenFOAMEnvironment.getEnvironment;
|
||||
import static eu.engys.core.controller.AbstractScriptFactory.INITIALISE_FIELDS_PARALLEL_BAT;
|
||||
import static eu.engys.core.controller.AbstractScriptFactory.INITIALISE_FIELDS_PARALLEL_RUN;
|
||||
import static eu.engys.core.controller.AbstractScriptFactory.INITIALISE_FIELDS_SERIAL_BAT;
|
||||
import static eu.engys.core.controller.AbstractScriptFactory.INITIALISE_FIELDS_SERIAL_RUN;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import eu.engys.core.controller.Controller;
|
||||
import eu.engys.core.controller.Controller.OpenOptions;
|
||||
import eu.engys.core.controller.Controller.OpenMode;
|
||||
import eu.engys.core.controller.KillCommandOS;
|
||||
import eu.engys.core.controller.ScriptFactory;
|
||||
import eu.engys.core.executor.Executor;
|
||||
import eu.engys.core.executor.ExecutorHook;
|
||||
import eu.engys.core.executor.ExecutorListener.ExecutorState;
|
||||
import eu.engys.core.executor.ExecutorMonitor;
|
||||
import eu.engys.core.executor.ExecutorTerminal;
|
||||
import eu.engys.core.executor.TerminalExecutorMonitor;
|
||||
import eu.engys.core.project.Model;
|
||||
import eu.engys.core.project.openFOAMProject;
|
||||
import eu.engys.util.Util;
|
||||
|
||||
public class StandardInitialiseFields extends InitialiseFields {
|
||||
|
||||
|
|
@ -53,27 +58,36 @@ public class StandardInitialiseFields extends InitialiseFields {
|
|||
public StandardInitialiseFields(Model model, Controller controller, ScriptFactory scriptFactory) {
|
||||
super(model, controller, scriptFactory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeExecute() {
|
||||
super.beforeExecute();
|
||||
FileUtils.deleteQuietly(new File(model.getProject().getBaseDir(), Util.isWindowsScriptStyle() ? INITIALISE_FIELDS_SERIAL_BAT : INITIALISE_FIELDS_SERIAL_RUN));
|
||||
FileUtils.deleteQuietly(new File(model.getProject().getBaseDir(), Util.isWindowsScriptStyle() ? INITIALISE_FIELDS_PARALLEL_BAT : INITIALISE_FIELDS_PARALLEL_RUN));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void executeClient() {
|
||||
logger.debug("EXECUTE IN CLIENT");
|
||||
File script = scriptFactory.getInitialiseScript(model);
|
||||
File baseDir = model.getProject().getBaseDir();
|
||||
File logFile = Paths.get(baseDir.getAbsolutePath(), openFOAMProject.LOG, LOG_NAME).toFile();
|
||||
|
||||
ExecutorTerminal terminal = new TerminalExecutorMonitor(logFile);
|
||||
|
||||
ExecutorMonitor monitor = new ExecutorMonitor();
|
||||
ExecutorService service = Executor.newExecutor(ACTION_NAME);
|
||||
monitor.addHook(ExecutorState.FINISH, new FinishHook());
|
||||
|
||||
ExecutorService service = Executor.newExecutor(ACTION_NAME);
|
||||
|
||||
this.executor = Executor.script(script).description(ACTION_NAME).inFolder(baseDir).inTerminal(terminal).withMonitors(monitor).inService(service).env(getEnvironment(model, LOG_NAME)).keepFileOnEnd();
|
||||
TerminalExecutorMonitor terminal = new TerminalExecutorMonitor(controller.getTerminalManager(), logFile);
|
||||
terminal.setStopCommand(new KillCommandOS(controller));
|
||||
|
||||
this.executor = Executor.script(scriptFactory.getInitialiseScript(model)).description(ACTION_NAME).inFolder(baseDir).inTerminal(terminal).withMonitors(monitor).inService(service).env(getEnvironment(model, LOG_NAME));
|
||||
executor.exec();
|
||||
}
|
||||
|
||||
private class FinishHook implements ExecutorHook {
|
||||
@Override
|
||||
public void run(ExecutorMonitor m) {
|
||||
controller.reopenCase(OpenOptions.CURRENT_SETTINGS);
|
||||
controller.reopenCase(OpenMode.CURRENT_SETTINGS);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,28 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.controller.actions;
|
||||
|
||||
import static eu.engys.core.OpenFOAMEnvironment.getEnvironment;
|
||||
|
|
@ -59,19 +58,19 @@ public class StandardRunCase extends RunCase {
|
|||
@Override
|
||||
public void executeClient() {
|
||||
logger.debug("EXECUTE IN CLIENT");
|
||||
File logFile = Paths.get(model.getProject().getBaseDir().getAbsolutePath(), openFOAMProject.LOG, model.getSolverModel().getLogFile()).toFile();
|
||||
TerminalExecutorMonitor terminal = new TerminalExecutorMonitor(logFile);
|
||||
terminal.setStopCommand(new StopOrKillCommandOS(controller));
|
||||
|
||||
File baseDir = model.getProject().getBaseDir();
|
||||
File logFile = Paths.get(baseDir.getAbsolutePath(), openFOAMProject.LOG, model.getSolverModel().getLogFile()).toFile();
|
||||
|
||||
ExecutorMonitor monitor = new ExecutorMonitor();
|
||||
monitor.addHook(ExecutorState.START, new StartHook());
|
||||
monitor.addHook(ExecutorState.RUNNING, new RunningHook());
|
||||
monitor.addHook(ExecutorState.FINISH, new FinishHook());
|
||||
monitor.addHook(ExecutorState.ERROR, new ErrorHook());
|
||||
monitor.addHook(ExecutorState.FINISH, new FinishHook());
|
||||
|
||||
ExecutorService service = Executor.newExecutor(ACTION_NAME);
|
||||
|
||||
File baseDir = model.getProject().getBaseDir();
|
||||
TerminalExecutorMonitor terminal = new TerminalExecutorMonitor(controller.getTerminalManager(), logFile);
|
||||
terminal.setStopCommand(new StopOrKillCommandOS(controller));
|
||||
|
||||
this.executor = Executor.script(scriptFactory.getSolverScript(model)).description(ACTION_NAME).inFolder(baseDir).inTerminal(terminal).withMonitors(monitor).inService(service).env(getEnvironment(model, model.getSolverModel().getLogFile())).keepFileOnEnd();
|
||||
executor.exec();
|
||||
|
|
@ -91,14 +90,14 @@ public class StandardRunCase extends RunCase {
|
|||
}
|
||||
}
|
||||
|
||||
protected class FinishHook implements ExecutorHook {
|
||||
private class FinishHook implements ExecutorHook {
|
||||
@Override
|
||||
public void run(ExecutorMonitor m) {
|
||||
model.getSolverModel().setServerState(new ServerState(Command.RUN_CASE, SolverState.FINISHED));
|
||||
}
|
||||
}
|
||||
|
||||
protected class ErrorHook implements ExecutorHook {
|
||||
private class ErrorHook implements ExecutorHook {
|
||||
@Override
|
||||
public void run(ExecutorMonitor m) {
|
||||
model.getSolverModel().setServerState(new ServerState(Command.RUN_CASE, SolverState.ERROR));
|
||||
|
|
|
|||
|
|
@ -1,28 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.controller.actions;
|
||||
|
||||
import static eu.engys.core.OpenFOAMEnvironment.getEnvironment;
|
||||
|
|
@ -35,6 +34,7 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import eu.engys.core.controller.Controller;
|
||||
import eu.engys.core.controller.KillCommandOS;
|
||||
import eu.engys.core.controller.ScriptFactory;
|
||||
import eu.engys.core.executor.Executor;
|
||||
import eu.engys.core.executor.ExecutorHook;
|
||||
|
|
@ -63,7 +63,10 @@ public class StandardRunMesh extends RunMesh {
|
|||
|
||||
ExecutorService service = Executor.newExecutor(ACTION_NAME);
|
||||
|
||||
this.executor = Executor.script(scriptFactory.getMeshScript(model)).description(ACTION_NAME).inFolder(baseDir).inService(service).inTerminal(new TerminalExecutorMonitor(logFile)).withMonitors(monitor).env(getEnvironment(model, LOG_NAME)).keepFileOnEnd();
|
||||
TerminalExecutorMonitor terminal = new TerminalExecutorMonitor(controller.getTerminalManager(), logFile);
|
||||
terminal.setStopCommand(new KillCommandOS(controller));
|
||||
|
||||
this.executor = Executor.script(scriptFactory.getMeshScript(model)).description(ACTION_NAME).inFolder(baseDir).inService(service).inTerminal(terminal).withMonitors(monitor).env(getEnvironment(model, LOG_NAME)).keepFileOnEnd();
|
||||
executor.exec();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,28 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.controller.actions;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
|
|
@ -34,6 +33,8 @@ public class StopCommandInfo extends CommandInfo {
|
|||
|
||||
private static final Logger logger = LoggerFactory.getLogger(StopCommandInfo.class);
|
||||
|
||||
public static final String TIMEOUT = "Timeout";
|
||||
|
||||
public boolean timeout;
|
||||
|
||||
public static StopCommandInfo wrap(CommandInfo info) {
|
||||
|
|
@ -48,7 +49,7 @@ public class StopCommandInfo extends CommandInfo {
|
|||
public static StopCommandInfo timeoutException(Exception e) {
|
||||
logger.error(">>> SERVER STOP ERROR", e);
|
||||
StopCommandInfo ci = new StopCommandInfo();
|
||||
ci.message = "Timeout";
|
||||
ci.message = TIMEOUT;
|
||||
ci.exception = e;
|
||||
ci.success = false;
|
||||
ci.timeout = true;
|
||||
|
|
|
|||
100
src/eu/engys/core/controller/actions/Stopper.java
Normal file
100
src/eu/engys/core/controller/actions/Stopper.java
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.controller.actions;
|
||||
|
||||
import static eu.engys.core.project.system.ControlDict.CONTROL_DICT;
|
||||
import static eu.engys.core.project.system.ControlDict.END_TIME_KEY;
|
||||
import static eu.engys.core.project.system.ControlDict.STOP_AT_KEY;
|
||||
import static eu.engys.core.project.system.ControlDict.WRITE_NOW_KEY;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import eu.engys.core.dictionary.DictionaryUtils;
|
||||
import eu.engys.core.executor.Executor;
|
||||
import eu.engys.core.project.Model;
|
||||
import eu.engys.core.project.system.ControlDict;
|
||||
import eu.engys.util.PrefUtil;
|
||||
|
||||
public class Stopper {
|
||||
|
||||
protected Executor executor;
|
||||
protected Model model;
|
||||
|
||||
public Stopper(Model model, Executor executor) {
|
||||
this.model = model;
|
||||
this.executor = executor;
|
||||
}
|
||||
|
||||
public void stop() throws Exception {
|
||||
setStopAtVariableToWriteNow();
|
||||
|
||||
waitForExecutorToStop();
|
||||
|
||||
setStopAtVariableToEndTime();
|
||||
}
|
||||
|
||||
protected void waitForExecutorToStop() throws Exception {
|
||||
int stop_refresh_time = PrefUtil.getInt(PrefUtil.SERVER_CONNECTION_REFRESH_TIME, 1000);
|
||||
int stop_max_tries = PrefUtil.getInt(PrefUtil.SERVER_CONNECTION_MAX_TRIES, 60);
|
||||
|
||||
int tryIndex = 0;
|
||||
while (this.executor.getState().isDoingSomething() && (tryIndex < stop_max_tries)) {
|
||||
try {
|
||||
Thread.sleep(stop_refresh_time);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
tryIndex++;
|
||||
}
|
||||
if (tryIndex >= stop_max_tries) {
|
||||
throw new TimeoutException("Timeout stopping solver");
|
||||
}
|
||||
}
|
||||
|
||||
private void setStopAtVariableToWriteNow() {
|
||||
File systemFolder = model.getProject().getSystemFolder().getFileManager().getFile();
|
||||
ControlDict controlDict = new ControlDict(new File(systemFolder, CONTROL_DICT));
|
||||
controlDict.add(STOP_AT_KEY, WRITE_NOW_KEY);
|
||||
DictionaryUtils.writeDictionary(systemFolder, controlDict, null);
|
||||
|
||||
ControlDict readControlDict = new ControlDict(new File(systemFolder, CONTROL_DICT));
|
||||
if(!readControlDict.found(STOP_AT_KEY) || !readControlDict.lookup(STOP_AT_KEY).equals(WRITE_NOW_KEY)){
|
||||
try {
|
||||
Thread.sleep(500L);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
setStopAtVariableToWriteNow();
|
||||
}
|
||||
}
|
||||
|
||||
void setStopAtVariableToEndTime() {
|
||||
File systemFolder = model.getProject().getSystemFolder().getFileManager().getFile();
|
||||
ControlDict controlDict = new ControlDict(new File(systemFolder, CONTROL_DICT));
|
||||
if (controlDict.found(STOP_AT_KEY) && controlDict.lookup(STOP_AT_KEY).equals(WRITE_NOW_KEY)) {
|
||||
controlDict.add(STOP_AT_KEY, END_TIME_KEY);
|
||||
DictionaryUtils.writeDictionary(systemFolder, controlDict, null);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,28 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.controller.actions;
|
||||
|
||||
public class TimeoutException extends Exception {
|
||||
|
|
|
|||
|
|
@ -1,28 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.dictionary;
|
||||
|
||||
import java.io.File;
|
||||
|
|
@ -130,7 +129,7 @@ public class BeanToDict {
|
|||
|
||||
for (Method m : methods) {
|
||||
String fieldName = "";
|
||||
if (m.getName().startsWith("get") && !m.getName().startsWith("getClass")) {
|
||||
if (m.getName().startsWith("get") && !m.getName().startsWith("getClass") && m.getParameterTypes().length == 0) {
|
||||
fieldName = getFieldNameFromGetter(m);
|
||||
} else if (m.getName().startsWith("is")) {
|
||||
fieldName = getFieldNameFromBooleanGetter(m);
|
||||
|
|
@ -143,7 +142,7 @@ public class BeanToDict {
|
|||
addToDictionary(dictionary, fieldName, value);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
logger.error("Error invoking method {}", m, ex);
|
||||
}
|
||||
}
|
||||
return dictionary;
|
||||
|
|
@ -225,6 +224,10 @@ public class BeanToDict {
|
|||
return dict;
|
||||
}
|
||||
|
||||
// public static <K, B> Map<K,B> dictToMap(Dictionary dictionary, B bean) {
|
||||
//
|
||||
// }
|
||||
|
||||
private static String toArray(Object array) throws Exception {
|
||||
return toBracketedArrayOfStrings(array);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,39 +1,37 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.dictionary;
|
||||
|
||||
import static eu.engys.core.dictionary.Dictionary.SPACER;
|
||||
import static eu.engys.core.dictionary.Dictionary.TAB;
|
||||
import static eu.engys.core.dictionary.Dictionary.VERBOSE;
|
||||
|
||||
import eu.engys.core.dictionary.parser.ListField2;
|
||||
|
||||
public class BlockMeshWriter extends DictionaryWriter {
|
||||
|
||||
|
||||
public BlockMeshWriter(Dictionary dictionary) {
|
||||
super(dictionary);
|
||||
}
|
||||
|
|
@ -50,10 +48,10 @@ public class BlockMeshWriter extends DictionaryWriter {
|
|||
BlockMeshWriter writer = new BlockMeshWriter(dictionary.getFoamFile());
|
||||
writer.writeDictionary(sb, "");
|
||||
|
||||
// if (dictionary.isList("")) {
|
||||
// ListField.class.cast(dictionary.getList()).writeListDict(sb, rowHeader);
|
||||
// return;
|
||||
// }
|
||||
// if (dictionary.isList("")) {
|
||||
// ListField.class.cast(dictionary.getList()).writeListDict(sb, rowHeader);
|
||||
// return;
|
||||
// }
|
||||
} else {
|
||||
sb.append("\n");
|
||||
sb.append(rowHeader);
|
||||
|
|
@ -66,7 +64,7 @@ public class BlockMeshWriter extends DictionaryWriter {
|
|||
DefaultElement ele = dictionary.getElement(key);
|
||||
write(sb, rowHeader, ele);
|
||||
}
|
||||
|
||||
|
||||
for (String includeFile : dictionary.getIncludeFiles()) {
|
||||
writeInclude(sb, includeFile, rowHeader);
|
||||
}
|
||||
|
|
@ -105,16 +103,18 @@ public class BlockMeshWriter extends DictionaryWriter {
|
|||
private static void writeDimensionedScalar(StringBuffer sb, DimensionedScalar ds, String rowHeader) {
|
||||
if (VERBOSE)
|
||||
System.out.println("Dictionary.writeDimensionedScalar() " + (ds != null ? ds.getName() : "NULL!!!"));
|
||||
sb.append("\n");
|
||||
sb.append(rowHeader);
|
||||
sb.append(TAB);
|
||||
sb.append(ds.getName());
|
||||
sb.append(SPACER);
|
||||
sb.append(ds.getName());
|
||||
sb.append(SPACER);
|
||||
sb.append(ds.getDimensions());
|
||||
sb.append(SPACER);
|
||||
sb.append(ds.getValue());
|
||||
sb.append(";");
|
||||
if (ds != null) {
|
||||
sb.append("\n");
|
||||
sb.append(rowHeader);
|
||||
sb.append(TAB);
|
||||
sb.append(ds.getName());
|
||||
sb.append(SPACER);
|
||||
sb.append(ds.getName());
|
||||
sb.append(SPACER);
|
||||
sb.append(ds.getDimensions());
|
||||
sb.append(SPACER);
|
||||
sb.append(ds.getValue());
|
||||
sb.append(";");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,39 +1,40 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.dictionary;
|
||||
|
||||
public class DefaultElement {
|
||||
import org.apache.commons.lang.builder.EqualsBuilder;
|
||||
import org.apache.commons.lang.builder.HashCodeBuilder;
|
||||
|
||||
public abstract class DefaultElement {
|
||||
|
||||
private String name;
|
||||
|
||||
|
||||
public DefaultElement(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
|
@ -41,12 +42,21 @@ public class DefaultElement {
|
|||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof DefaultElement) {
|
||||
return ((DefaultElement) obj).name.equals(name);
|
||||
}
|
||||
return super.equals(obj);
|
||||
if (!(obj instanceof DefaultElement)) {
|
||||
return false;
|
||||
}
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
DefaultElement fz = (DefaultElement) obj;
|
||||
return new EqualsBuilder().append(name, fz.name).isEquals();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return new HashCodeBuilder(17, 31).append(name).toHashCode();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,28 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
|
||||
package eu.engys.core.dictionary;
|
||||
|
||||
|
|
@ -45,6 +44,36 @@ public class DictionaryBuilder {
|
|||
dictionary.add(k, v);
|
||||
return this;
|
||||
}
|
||||
|
||||
public DictionaryBuilder field(String k, Double v) {
|
||||
dictionary.add(k, v);
|
||||
return this;
|
||||
}
|
||||
|
||||
public DictionaryBuilder field(String k, Integer v) {
|
||||
dictionary.add(k, v);
|
||||
return this;
|
||||
}
|
||||
|
||||
public DictionaryBuilder fieldUniform(String k, Double v) {
|
||||
dictionary.addUniform(k, v);
|
||||
return this;
|
||||
}
|
||||
|
||||
public DictionaryBuilder field(String k, boolean v) {
|
||||
dictionary.add(k, v);
|
||||
return this;
|
||||
}
|
||||
|
||||
public DictionaryBuilder field(String k, double[] d) {
|
||||
dictionary.add(k, d);
|
||||
return this;
|
||||
}
|
||||
|
||||
public DictionaryBuilder fieldUniform(String k, double[] d) {
|
||||
dictionary.addUniform(k, d);
|
||||
return this;
|
||||
}
|
||||
|
||||
public DictionaryBuilder dimensionedScalar(String k, String v, String d) {
|
||||
dictionary.add(new DimensionedScalar(k, v, d));
|
||||
|
|
|
|||
|
|
@ -1,28 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
|
||||
package eu.engys.core.dictionary;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,28 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
|
||||
package eu.engys.core.dictionary;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,28 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
|
||||
package eu.engys.core.dictionary;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,28 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
|
||||
package eu.engys.core.dictionary;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,36 +1,45 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.dictionary;
|
||||
|
||||
import static eu.engys.core.dictionary.Dictionary.SPACER;
|
||||
import static eu.engys.core.dictionary.Dictionary.TAB;
|
||||
import static eu.engys.core.dictionary.Dictionary.VERBOSE;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import eu.engys.core.dictionary.parser.ListField2;
|
||||
|
||||
public class DictionaryWriter {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(DictionaryWriter.class);
|
||||
|
||||
private static final String SCALAR_TAG = "<scalar>";
|
||||
private static final String VECTOR_TAG = "<vector>";
|
||||
private static final String LIST = "List";
|
||||
|
||||
protected Dictionary dictionary;
|
||||
|
||||
|
|
@ -87,7 +96,7 @@ public class DictionaryWriter {
|
|||
if (ele != null) {
|
||||
writeElement(sb, rowHeader, ele);
|
||||
} else {
|
||||
System.out.println("DictionaryWriter.writeDictionary() ------------------------------>> " + key + " is NUUULLLLL in " + dictionary.getKeys() + " and " + dictionary.getDictionaries());
|
||||
logger.error("Dictionary \"{}\" does not contain key {}. Keys are {}", dictionary.getName(), key, dictionary.getKeys());
|
||||
}
|
||||
}
|
||||
for (String includeFile : dictionary.getIncludeFiles()) {
|
||||
|
|
@ -99,7 +108,9 @@ public class DictionaryWriter {
|
|||
}
|
||||
|
||||
public static void writeElement(StringBuffer sb, String rowHeader, DefaultElement ele) {
|
||||
if (ele instanceof Dictionary) {
|
||||
if (ele == null) {
|
||||
logger.error("A NULL element has not been written in \n{}", sb.toString());
|
||||
} else if (ele instanceof Dictionary) {
|
||||
DictionaryWriter writer = new DictionaryWriter((Dictionary) ele);
|
||||
writer.writeDictionary(sb, rowHeader + TAB);
|
||||
} else if (ele instanceof DimensionedScalar) {
|
||||
|
|
@ -120,7 +131,7 @@ public class DictionaryWriter {
|
|||
private static boolean hasParenthesis(DefaultElement ele) {
|
||||
FieldElement fieldElement = (FieldElement) ele;
|
||||
String value = fieldElement.getValue();
|
||||
return value != null && value.contains("(") && value.contains("List");
|
||||
return value != null && value.contains("(") && value.contains(LIST);
|
||||
}
|
||||
|
||||
protected static void writeField(StringBuffer sb, FieldElement field, String rowHeader) {
|
||||
|
|
@ -146,9 +157,9 @@ public class DictionaryWriter {
|
|||
sb.append(SPACER);
|
||||
String value = field.getValue();
|
||||
if (value.contains("vector")) {
|
||||
sb.append(value.replace("(", "\n(").replace("))", ")\n)").replace("<vector>", "<vector>\n"));
|
||||
sb.append(value.replace("(", "\n(").replace("))", ")\n)").replace(VECTOR_TAG, VECTOR_TAG+"\n"));
|
||||
} else {
|
||||
sb.append(value.replace("(", "\n(").replace("<scalar>", "<scalar>\n").replaceAll("\\s+", "\n"));
|
||||
sb.append(value.replace("(", "\n(").replace(SCALAR_TAG, SCALAR_TAG+"\n").replaceAll("\\s+", "\n"));
|
||||
}
|
||||
sb.append(";");
|
||||
}
|
||||
|
|
@ -167,16 +178,18 @@ public class DictionaryWriter {
|
|||
private static void writeDimensionedScalar(StringBuffer sb, DimensionedScalar ds, String rowHeader) {
|
||||
if (VERBOSE)
|
||||
System.out.println("Dictionary.writeDimensionedScalar() " + (ds != null ? ds.getName() : "NULL!!!"));
|
||||
sb.append("\n");
|
||||
sb.append(rowHeader);
|
||||
sb.append(TAB);
|
||||
sb.append(ds.getName());
|
||||
sb.append(SPACER);
|
||||
sb.append(ds.getName());
|
||||
sb.append(SPACER);
|
||||
sb.append(ds.getDimensions());
|
||||
sb.append(SPACER);
|
||||
sb.append(ds.getValue());
|
||||
sb.append(";");
|
||||
if (ds != null) {
|
||||
sb.append("\n");
|
||||
sb.append(rowHeader);
|
||||
sb.append(TAB);
|
||||
sb.append(ds.getName());
|
||||
sb.append(SPACER);
|
||||
sb.append(ds.getName());
|
||||
sb.append(SPACER);
|
||||
sb.append(ds.getDimensions());
|
||||
sb.append(SPACER);
|
||||
sb.append(ds.getValue());
|
||||
sb.append(";");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,28 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
|
||||
package eu.engys.core.dictionary;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,36 +0,0 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
package eu.engys.core.dictionary;
|
||||
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
public interface FieldChangeListener extends ActionListener {
|
||||
|
||||
public void fieldChanged();
|
||||
public boolean isAdjusting();
|
||||
public void setAdjusting(boolean b);
|
||||
}
|
||||
|
|
@ -1,62 +1,79 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.dictionary;
|
||||
|
||||
import org.apache.commons.lang.builder.EqualsBuilder;
|
||||
import org.apache.commons.lang.builder.HashCodeBuilder;
|
||||
|
||||
public class FieldElement extends DefaultElement {
|
||||
|
||||
private String value;
|
||||
|
||||
|
||||
public FieldElement(String name, String value) {
|
||||
super(name);
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public FieldElement(FieldElement el) {
|
||||
this(el.getName(), el.getValue());
|
||||
}
|
||||
this(el.getName(), el.getValue());
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getName() + "[" + value + "]";
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof FieldElement) {
|
||||
return ((FieldElement) obj).getName().equals(getName()) && ((FieldElement) obj).value.equals(value) ;
|
||||
}
|
||||
return false;
|
||||
if (!(obj instanceof FieldElement)) {
|
||||
return false;
|
||||
}
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
FieldElement fe = (FieldElement) obj;
|
||||
return new EqualsBuilder()
|
||||
.appendSuper(super.equals(obj))
|
||||
.append(value, fe.value)
|
||||
.isEquals();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return new HashCodeBuilder(17, 31)
|
||||
.appendSuper(super.hashCode())
|
||||
.append(value)
|
||||
.toHashCode();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,28 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
|
||||
package eu.engys.core.dictionary;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,32 +1,31 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.dictionary;
|
||||
|
||||
public interface Finder {
|
||||
|
||||
boolean accept(String key);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,28 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
|
||||
package eu.engys.core.dictionary;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,28 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
|
||||
package eu.engys.core.dictionary;
|
||||
|
||||
|
|
@ -185,4 +184,14 @@ public class ListField extends DefaultElement {
|
|||
return null;
|
||||
}
|
||||
|
||||
public List<Dictionary> getDictionaries() {
|
||||
List<Dictionary> dicts = new ArrayList<>();
|
||||
for (DefaultElement e : list) {
|
||||
if (e instanceof Dictionary) {
|
||||
dicts.add((Dictionary) e);
|
||||
}
|
||||
}
|
||||
return dicts;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,28 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
|
||||
package eu.engys.core.dictionary;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,28 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
|
||||
package eu.engys.core.dictionary;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,28 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.dictionary;
|
||||
|
||||
public class StartWithFinder implements Finder {
|
||||
|
|
@ -37,4 +36,4 @@ public class StartWithFinder implements Finder {
|
|||
public boolean accept(String key) {
|
||||
return key.startsWith(keyToFind);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,32 +1,35 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
|
||||
package eu.engys.core.dictionary;
|
||||
|
||||
import static eu.engys.core.dictionary.Dictionary.SPACER;
|
||||
|
||||
import org.apache.commons.lang.builder.EqualsBuilder;
|
||||
import org.apache.commons.lang.builder.HashCodeBuilder;
|
||||
|
||||
import eu.engys.core.dictionary.parser.ListField2;
|
||||
|
||||
public class TableRowElement extends DefaultElement {
|
||||
|
|
@ -73,28 +76,30 @@ public class TableRowElement extends DefaultElement {
|
|||
return values;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof TableRowElement) {
|
||||
TableRowElement t = ((TableRowElement) obj);
|
||||
return key.equals(t.key) /*&& valuesAreEquals(t.values)*/;
|
||||
}
|
||||
return super.equals(obj);
|
||||
}
|
||||
|
||||
private boolean valuesAreEquals(FieldElement[] values) {
|
||||
if (this.values.length != values.length) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < values.length; i++) {
|
||||
if (!this.values[i].equals(values[i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void merge(TableRowElement el) {
|
||||
this.values = el.values;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof TableRowElement)) {
|
||||
return false;
|
||||
}
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
TableRowElement el = (TableRowElement) obj;
|
||||
return new EqualsBuilder()
|
||||
.appendSuper(super.equals(obj))
|
||||
.append(key, el.key)
|
||||
.isEquals();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return new HashCodeBuilder(17, 31)
|
||||
.appendSuper(super.hashCode())
|
||||
.append(key)
|
||||
.toHashCode();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,31 +1,33 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
|
||||
package eu.engys.core.dictionary.model;
|
||||
|
||||
import static eu.engys.util.ui.UiUtil.ADD_ROW_BUTTON_NAME;
|
||||
import static eu.engys.util.ui.UiUtil.REM_ROW_BUTTON_NAME;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.event.ActionEvent;
|
||||
|
|
@ -87,11 +89,11 @@ public abstract class AbstractTableAdapter extends JPanel {
|
|||
buttonsPanel.setOpaque(false);
|
||||
|
||||
JButton addButton = new JButton(new AddRowAction());
|
||||
addButton.setName("add.row.button");
|
||||
addButton.setName(ADD_ROW_BUTTON_NAME);
|
||||
buttonsPanel.add(addButton);
|
||||
|
||||
JButton remButton = new JButton(new RemRowAction());
|
||||
remButton.setName("rem.row.button");
|
||||
remButton.setName(REM_ROW_BUTTON_NAME);
|
||||
buttonsPanel.add(remButton);
|
||||
return buttonsPanel;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,28 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.dictionary.model;
|
||||
|
||||
import eu.engys.util.ui.textfields.DoubleField;
|
||||
|
|
@ -33,24 +32,54 @@ public class AxisInfo {
|
|||
public static final String LABEL = "Point ";
|
||||
private DoubleField[] center;
|
||||
private EventActionType action;
|
||||
private DoubleField[] axis;
|
||||
private double magnitude;
|
||||
private DoubleField toe;
|
||||
private DoubleField camber;
|
||||
private DoubleField[] axis;
|
||||
private int sign;
|
||||
|
||||
public AxisInfo(DoubleField[] axis, DoubleField[] center, EventActionType action) {
|
||||
this.axis = axis;
|
||||
this.center = center;
|
||||
public AxisInfo(DoubleField toe, DoubleField camber, DoubleField[] center, double magnitude, int sign, EventActionType action) {
|
||||
this.toe = toe;
|
||||
this.camber = camber;
|
||||
this.center = center;
|
||||
this.sign = sign;
|
||||
this.action = action;
|
||||
this.magnitude = magnitude;
|
||||
}
|
||||
|
||||
public DoubleField[] getAxis() {
|
||||
return axis;
|
||||
public AxisInfo(DoubleField[] axis, DoubleField[] center, int magnitude, EventActionType action) {
|
||||
this.axis = axis;
|
||||
this.center = center;
|
||||
this.magnitude = magnitude;
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public DoubleField getToe() {
|
||||
return toe;
|
||||
}
|
||||
|
||||
public DoubleField getCamber() {
|
||||
return camber;
|
||||
}
|
||||
|
||||
public int getSign() {
|
||||
return sign;
|
||||
}
|
||||
|
||||
public DoubleField[] getCenter() {
|
||||
return center;
|
||||
}
|
||||
|
||||
public DoubleField[] getAxis() {
|
||||
return axis;
|
||||
}
|
||||
|
||||
public EventActionType getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
}
|
||||
public double getMagnitude() {
|
||||
return magnitude;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,28 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.dictionary.model;
|
||||
|
||||
import static eu.engys.util.ui.ComponentsFactory.checkBoxControllerField;
|
||||
|
|
@ -39,6 +38,7 @@ import static eu.engys.util.ui.ComponentsFactory.selectField;
|
|||
import static eu.engys.util.ui.ComponentsFactory.spinnerField;
|
||||
import static eu.engys.util.ui.ComponentsFactory.stringField;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
|
@ -54,7 +54,9 @@ import java.util.concurrent.CopyOnWriteArrayList;
|
|||
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.ListModel;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
|
@ -62,10 +64,10 @@ import org.slf4j.LoggerFactory;
|
|||
import eu.engys.core.dictionary.Dictionary;
|
||||
import eu.engys.core.dictionary.DictionaryUtils;
|
||||
import eu.engys.core.dictionary.DimensionedScalar;
|
||||
import eu.engys.core.dictionary.FieldChangeListener;
|
||||
import eu.engys.core.project.zero.patches.Patches;
|
||||
import eu.engys.util.filechooser.util.SelectionMode;
|
||||
import eu.engys.util.ui.ComponentsFactory;
|
||||
import eu.engys.util.ui.FieldChangeListener;
|
||||
import eu.engys.util.ui.FileFieldPanel;
|
||||
import eu.engys.util.ui.ListBuilder;
|
||||
import eu.engys.util.ui.ListFieldPanel;
|
||||
|
|
@ -91,8 +93,8 @@ public class DictionaryModel {
|
|||
public void dictionaryChanged() throws DictionaryError;
|
||||
}
|
||||
|
||||
private List<DictionaryListener> listeners = new CopyOnWriteArrayList<DictionaryModel.DictionaryListener>();
|
||||
private Map<String, DictionaryModel> subModels = new HashMap<String, DictionaryModel>();
|
||||
private List<DictionaryListener> listeners = new CopyOnWriteArrayList<>();
|
||||
private Map<String, DictionaryModel> subModels = new HashMap<>();
|
||||
|
||||
public static class DictionaryError extends Exception {
|
||||
private String[] messages;
|
||||
|
|
@ -222,26 +224,34 @@ public class DictionaryModel {
|
|||
}
|
||||
|
||||
public JCheckBox bindBoolean(String key) {
|
||||
JCheckBox field = checkField();
|
||||
field.addActionListener(new BooleanFieldHandler(key, field, false));
|
||||
return field;
|
||||
return bindBoolean(key, false);
|
||||
}
|
||||
|
||||
public JCheckBox bindBoolean(String key, boolean def) {
|
||||
JCheckBox field = checkField(def);
|
||||
field.addActionListener(new BooleanFieldHandler(key, field, def));
|
||||
return field;
|
||||
return bindBoolean(key, def, true);
|
||||
}
|
||||
|
||||
public JCheckBox bindBoolean(String key, boolean def, boolean fireEvent) {
|
||||
JCheckBox field = checkField(def);
|
||||
field.addActionListener(new BooleanFieldHandler(key, field, def, fireEvent));
|
||||
return field;
|
||||
}
|
||||
|
||||
public JCheckBox bindBoolean(String key, String trueValue, String falseValue) {
|
||||
JCheckBox field = checkField();
|
||||
field.addActionListener(new BooleanValuesFieldHandler(key, field, trueValue, falseValue));
|
||||
field.addActionListener(new BooleanValuesFieldHandler(key, field, trueValue, falseValue, false));
|
||||
return field;
|
||||
}
|
||||
|
||||
public JCheckBox bindBoolean(String key, String trueValue, String falseValue, boolean def) {
|
||||
JCheckBox field = checkField(def);
|
||||
field.addActionListener(new BooleanValuesFieldHandler(key, field, trueValue, falseValue));
|
||||
field.addActionListener(new BooleanValuesFieldHandler(key, field, trueValue, falseValue, false));
|
||||
return field;
|
||||
}
|
||||
|
||||
public JCheckBox bindBoolean(String key, String trueValue, String falseValue, boolean def, boolean lightEvent) {
|
||||
JCheckBox field = checkField(def);
|
||||
field.addActionListener(new BooleanValuesFieldHandler(key, field, trueValue, falseValue, lightEvent));
|
||||
return field;
|
||||
}
|
||||
|
||||
|
|
@ -291,7 +301,6 @@ public class DictionaryModel {
|
|||
|
||||
// public IntegerField bindInteger(String key, String name) {
|
||||
// IntegerField field = bindInteger(key);
|
||||
// field.setName(name);
|
||||
// return field;
|
||||
// }
|
||||
|
||||
|
|
@ -334,7 +343,6 @@ public class DictionaryModel {
|
|||
|
||||
// public DoubleField bindUniformDoubleWithName(String key, String name) {
|
||||
// DoubleField field = doubleField();
|
||||
// field.setName(name);
|
||||
// field.addPropertyChangeListener(new DoubleUniformFieldHandler(key,
|
||||
// field));
|
||||
// return field;
|
||||
|
|
@ -377,6 +385,13 @@ public class DictionaryModel {
|
|||
return field;
|
||||
}
|
||||
|
||||
public DoubleField bindDoubleAndUniformDouble(String key1, String key2) {
|
||||
DoubleField field = doubleField();
|
||||
field.addPropertyChangeListener(new DoubleFieldHandler(key1, field, null));
|
||||
field.addPropertyChangeListener(new DoubleUniformFieldHandler(key2, field));
|
||||
return field;
|
||||
}
|
||||
|
||||
public DoubleField bindDouble(String key) {
|
||||
return bindDouble(key, (FieldChangeListener) null);
|
||||
}
|
||||
|
|
@ -393,6 +408,42 @@ public class DictionaryModel {
|
|||
return field;
|
||||
}
|
||||
|
||||
public JComponent bindCheckAndDouble(final String key, Double def) {
|
||||
final JCheckBox checkBox = checkField();
|
||||
final DoubleField field = doubleField(def);
|
||||
field.addPropertyChangeListener(new DoubleFieldHandler(key, field, null));
|
||||
field.setEnabled(false);
|
||||
checkBox.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (checkBox.isSelected()) {
|
||||
field.setEnabled(true);
|
||||
} else {
|
||||
field.setValue(null);
|
||||
field.setEnabled(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
DictionaryModel.this.addDictionaryListener(new DictionaryListener() {
|
||||
@Override
|
||||
public void dictionaryChanged() throws DictionaryError {
|
||||
checkBox.setSelected(dictionary.found(key));
|
||||
field.setEnabled(checkBox.isSelected());
|
||||
}
|
||||
});
|
||||
JPanel panel = new JPanel(new BorderLayout()) {
|
||||
@Override
|
||||
public void setName(String name) {
|
||||
super.setName(name);
|
||||
checkBox.setName(name);
|
||||
field.setName(name);
|
||||
}
|
||||
};
|
||||
panel.add(checkBox, BorderLayout.WEST);
|
||||
panel.add(field, BorderLayout.CENTER);
|
||||
return panel;
|
||||
}
|
||||
|
||||
public DoubleField bindDouble(String key, Double def) {
|
||||
DoubleField field = doubleField(def);
|
||||
field.addPropertyChangeListener(new DoubleFieldHandler(key, field, null));
|
||||
|
|
@ -435,7 +486,6 @@ public class DictionaryModel {
|
|||
DoubleField[] field = doublePointField();
|
||||
for (int i = 0; i < field.length; i++) {
|
||||
DoubleField f = field[i];
|
||||
f.setName(key + "." + i);
|
||||
f.addPropertyChangeListener(new PointFieldHandler(key, field, listener));
|
||||
}
|
||||
return field;
|
||||
|
|
@ -445,12 +495,21 @@ public class DictionaryModel {
|
|||
DoubleField[] field = doublePointField(places);
|
||||
for (int i = 0; i < field.length; i++) {
|
||||
DoubleField f = field[i];
|
||||
f.setName(key + "." + i);
|
||||
f.addPropertyChangeListener(new PointFieldHandler(key, field, listener));
|
||||
}
|
||||
return field;
|
||||
}
|
||||
|
||||
public DoubleField[] bindPointAndUniformPoint(String key1, String key2) {
|
||||
DoubleField[] field = doublePointField();
|
||||
for (int i = 0; i < field.length; i++) {
|
||||
DoubleField f = field[i];
|
||||
f.addPropertyChangeListener(new PointFieldHandler(key1, field, null));
|
||||
f.addPropertyChangeListener(new PointUniformFieldHandler(key2, field));
|
||||
}
|
||||
return field;
|
||||
}
|
||||
|
||||
public DoubleField[] bindPoint(String key) {
|
||||
return bindPoint(key, null);
|
||||
}
|
||||
|
|
@ -479,16 +538,6 @@ public class DictionaryModel {
|
|||
return field;
|
||||
}
|
||||
|
||||
// public DoubleField[] bindUniformPointWithName(String key, String name) {
|
||||
// DoubleField[] field = doublePointField();
|
||||
// for (int i = 0; i < field.length; i++) {
|
||||
// DoubleField f = field[i];
|
||||
// f.setName(name + "." + i);
|
||||
// f.addPropertyChangeListener(new PointUniformFieldHandler(key, field));
|
||||
// }
|
||||
// return field;
|
||||
// }
|
||||
|
||||
public DoubleField[] bindUniformPoint(String key1, String key2) {
|
||||
DoubleField[] field = doublePointField();
|
||||
for (int i = 0; i < field.length; i++) {
|
||||
|
|
@ -513,7 +562,6 @@ public class DictionaryModel {
|
|||
for (int i = 0; i < field.length; i++) {
|
||||
DoubleField f = field[i];
|
||||
f.setColumns(1);
|
||||
f.setName(key + "." + i);
|
||||
f.addPropertyChangeListener(new PointFieldHandler(key, field, null));
|
||||
}
|
||||
return field;
|
||||
|
|
@ -543,6 +591,12 @@ public class DictionaryModel {
|
|||
return combo;
|
||||
}
|
||||
|
||||
public JComboBox<String> bindSelection(String key, ListModel<String> listModel) {
|
||||
JComboBox<String> combo = selectField(listModel);
|
||||
combo.addActionListener(new SelectFieldHandler(key, combo, null));
|
||||
return combo;
|
||||
}
|
||||
|
||||
public JComboBox<String> bindSelection(String key, String... keys) {
|
||||
JComboBox<String> combo = selectField(keys, keys);
|
||||
combo.addActionListener(new SelectFieldHandler(key, combo, null));
|
||||
|
|
@ -567,7 +621,7 @@ public class DictionaryModel {
|
|||
|
||||
public JCheckBoxController bindCheckBoxController(String key, String name) {
|
||||
JCheckBoxController combo = checkBoxControllerField(name);
|
||||
combo.addActionListener(new BooleanFieldHandler(key, combo, false));
|
||||
combo.addActionListener(new BooleanFieldHandler(key, combo, false, true));
|
||||
return combo;
|
||||
}
|
||||
|
||||
|
|
@ -647,7 +701,7 @@ public class DictionaryModel {
|
|||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
if (evt.getPropertyName().equals("value")) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("(");
|
||||
sb.append("( ");
|
||||
for (int i = 0; i < field.length; i++) {
|
||||
sb.append(field[i].getDoubleValue());
|
||||
sb.append(" ");
|
||||
|
|
@ -767,19 +821,15 @@ public class DictionaryModel {
|
|||
|
||||
class SpinnerFieldHandler implements PropertyChangeListener, DictionaryListener {
|
||||
public SpinnerFieldHandler(String key, SpinnerField field) {
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dictionaryChanged() throws DictionaryError {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -899,7 +949,7 @@ public class DictionaryModel {
|
|||
dictionary.add(key, sb.toString());
|
||||
logger.trace("PointFieldHandler -> value: {}", dictionary.lookup(key));
|
||||
if (listener != null) {
|
||||
listener.fieldChanged();
|
||||
listener.fieldChanged(evt.getSource());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -949,7 +999,7 @@ public class DictionaryModel {
|
|||
dictionary.add(key, Double.toString(field.getDoubleValue()));
|
||||
logger.trace("DoubleFieldHandler -> value: {}", dictionary.lookup(key));
|
||||
if (listener != null) {
|
||||
listener.fieldChanged();
|
||||
listener.fieldChanged(evt.getSource());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -986,7 +1036,7 @@ public class DictionaryModel {
|
|||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
if (evt.getPropertyName().equals("value")) {
|
||||
if (!Double.isInfinite(field.getDoubleValue())) {
|
||||
dictionary.add(key, "uniform " + Double.toString(field.getDoubleValue()));
|
||||
dictionary.addUniform(key, field.getDoubleValue());
|
||||
logger.trace("DoubleUniformFieldHandler -> value: {}", dictionary.lookup(key));
|
||||
}
|
||||
}
|
||||
|
|
@ -1022,7 +1072,7 @@ public class DictionaryModel {
|
|||
@Override
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
if (evt.getPropertyName().equals("value")) {
|
||||
dictionary.add(key, "uniform " + Double.toString(-Math.abs(field.getDoubleValue())));
|
||||
dictionary.addUniform(key, -Math.abs(field.getDoubleValue()));
|
||||
logger.trace("DoubleUniformFieldHandler -> " + dictionary.toString());
|
||||
}
|
||||
}
|
||||
|
|
@ -1053,7 +1103,7 @@ public class DictionaryModel {
|
|||
@Override
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
if (evt.getPropertyName().equals("value")) {
|
||||
dictionary.add(key, "uniform " + Double.toString(Math.abs(field.getDoubleValue())));
|
||||
dictionary.addUniform(key, Math.abs(field.getDoubleValue()));
|
||||
logger.trace("DoubleUniformFieldHandler -> " + dictionary.toString());
|
||||
}
|
||||
}
|
||||
|
|
@ -1084,7 +1134,7 @@ public class DictionaryModel {
|
|||
@Override
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
if (evt.getPropertyName().equals("value")) {
|
||||
dictionary.add(key, "constant " + Double.toString(field.getDoubleValue()));
|
||||
dictionary.addConstant(key, field.getDoubleValue());
|
||||
logger.trace("DoubleUniformFieldHandler -> value: {}", dictionary.lookup(key));
|
||||
}
|
||||
}
|
||||
|
|
@ -1107,11 +1157,13 @@ public class DictionaryModel {
|
|||
private JCheckBox check;
|
||||
private String key;
|
||||
private final boolean def;
|
||||
private boolean fireEvent;
|
||||
|
||||
public BooleanFieldHandler(String key, JCheckBox check, boolean def) {
|
||||
public BooleanFieldHandler(String key, JCheckBox check, boolean def, boolean fireEvent) {
|
||||
this.check = check;
|
||||
this.key = key;
|
||||
this.def = def;
|
||||
this.fireEvent = fireEvent;
|
||||
DictionaryModel.this.addDictionaryListener(this);
|
||||
}
|
||||
|
||||
|
|
@ -1128,7 +1180,9 @@ public class DictionaryModel {
|
|||
String correctedForYesNo = value == null ? String.valueOf(def) : value.equals("yes") ? "true" : value.equals("no") ? "false" : value;
|
||||
boolean b = Boolean.parseBoolean(correctedForYesNo);
|
||||
if (b != check.isSelected()) {
|
||||
check.doClick();
|
||||
if(fireEvent){
|
||||
check.doClick();
|
||||
}
|
||||
check.setSelected(b);
|
||||
}
|
||||
logger.trace("BooleanFieldHandler -> value: {}", value);
|
||||
|
|
@ -1141,12 +1195,14 @@ public class DictionaryModel {
|
|||
private String key;
|
||||
private final String trueValue;
|
||||
private final String falseValue;
|
||||
private boolean lightEvent;
|
||||
|
||||
public BooleanValuesFieldHandler(String key, JCheckBox check, String trueValue, String falseValue) {
|
||||
public BooleanValuesFieldHandler(String key, JCheckBox check, String trueValue, String falseValue, boolean lightEvent) {
|
||||
this.check = check;
|
||||
this.key = key;
|
||||
this.trueValue = trueValue;
|
||||
this.falseValue = falseValue;
|
||||
this.lightEvent = lightEvent;
|
||||
DictionaryModel.this.addDictionaryListener(this);
|
||||
}
|
||||
|
||||
|
|
@ -1162,7 +1218,11 @@ public class DictionaryModel {
|
|||
String value = dictionary.lookup(key);
|
||||
boolean selected = value != null && value.equals(trueValue);
|
||||
if (shouldClick(selected, check.isSelected())) {
|
||||
check.doClick();
|
||||
if(lightEvent){
|
||||
check.setSelected(!check.isSelected());
|
||||
} else {
|
||||
check.doClick();
|
||||
}
|
||||
}
|
||||
logger.trace("BooleanValuesFieldHandler -> value: {}", value);
|
||||
}
|
||||
|
|
@ -1232,11 +1292,10 @@ public class DictionaryModel {
|
|||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
if (evt.getPropertyName().equals("value")) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("(");
|
||||
sb.append("( ");
|
||||
for (int i = 0; i < field.length; i++) {
|
||||
if (field[i].getValue() != null) {
|
||||
sb.append(field[i].getDoubleValue());
|
||||
sb.append(" ");
|
||||
sb.append(field[i].getDoubleValue() + " ");
|
||||
} else {
|
||||
sb.append("0 ");
|
||||
}
|
||||
|
|
@ -1245,7 +1304,7 @@ public class DictionaryModel {
|
|||
dictionary.add(key, sb.toString());
|
||||
logger.trace("PointFieldHandler -> value: {}", dictionary.lookup(key));
|
||||
if (listener != null) {
|
||||
listener.fieldChanged();
|
||||
listener.fieldChanged(evt.getSource());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1292,14 +1351,7 @@ public class DictionaryModel {
|
|||
return;
|
||||
}
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("uniform (");
|
||||
for (int i = 0; i < field.length; i++) {
|
||||
sb.append(field[i].getDoubleValue());
|
||||
sb.append(" ");
|
||||
}
|
||||
sb.append(")");
|
||||
dictionary.add(key, sb.toString());
|
||||
dictionary.addUniform(key, DoubleField.toArray(field));
|
||||
logger.trace("PointFieldHandler -> value: {}", dictionary.lookup(key));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,28 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.dictionary.model;
|
||||
|
||||
import static eu.engys.core.dictionary.Dictionary.TYPE;
|
||||
|
|
@ -85,9 +84,13 @@ public class DictionaryPanelBuilder extends PanelBuilder {
|
|||
}
|
||||
|
||||
public void selectDictionaries(Dictionary newDictionary, Dictionary newCompanion) {
|
||||
selectDictionaries(newDictionary, newCompanion, TYPE);
|
||||
}
|
||||
|
||||
public void selectDictionaries(Dictionary newDictionary, Dictionary newCompanion, String selector) {
|
||||
String newName = newDictionary.getName();
|
||||
String newType = newDictionary.lookup(TYPE);
|
||||
String newCompanionType = newCompanion.lookup(TYPE);
|
||||
String newType = newDictionary.lookup(selector);
|
||||
String newCompanionType = newCompanion.lookup(selector);
|
||||
// System.out.println("ChoicePanelBuilder.selectDictionary() NEW TYPE: "+newType+" NEW NAME: "+newName+" NEW COMPANION TYPE: "+newCompanionType);
|
||||
// System.out.println("-------------------");
|
||||
for (String key : modelsByKey.keySet()) {
|
||||
|
|
@ -96,8 +99,8 @@ public class DictionaryPanelBuilder extends PanelBuilder {
|
|||
if (model.getCompanions().size() > 0) {
|
||||
Dictionary oldCompanion = model.getCompanions().get(0).getDictionary();
|
||||
String oldName = oldDictionary.getName();
|
||||
String oldType = oldDictionary.lookup(TYPE);
|
||||
String oldCompanionType = oldCompanion.lookup(TYPE);
|
||||
String oldType = oldDictionary.lookup(selector);
|
||||
String oldCompanionType = oldCompanion.lookup(selector);
|
||||
// System.out.println("DictionaryPanelBuilder.selectDictionaries() OLD TYPE: "+oldType+" OLD NAME: "+oldName+" OLD COMPANION TYPE: "+oldCompanionType);
|
||||
|
||||
if (newName.equals(oldName) && newType.equals(oldType) && newCompanionType.equals(oldCompanionType)) {
|
||||
|
|
@ -117,9 +120,13 @@ public class DictionaryPanelBuilder extends PanelBuilder {
|
|||
}
|
||||
|
||||
public void selectDictionary(Dictionary newDictionary) {
|
||||
selectDictionary(newDictionary, TYPE);
|
||||
}
|
||||
|
||||
public void selectDictionary(Dictionary newDictionary, String selector) {
|
||||
if (newDictionary != null /* && newDictionary.found(TYPE) */) {
|
||||
String newName = newDictionary.getName();
|
||||
String newType = newDictionary.lookup(TYPE);
|
||||
String newType = newDictionary.lookup(selector);
|
||||
|
||||
// System.out.println("DictionaryPanelBuilder.selectDictionary() NEW TYPE: "+newType+" NEW NAME: "+newName);
|
||||
if (newName != null && newType != null) {
|
||||
|
|
@ -128,7 +135,7 @@ public class DictionaryPanelBuilder extends PanelBuilder {
|
|||
if (model.getCompanions().size() == 0) {
|
||||
Dictionary oldDictionary = model.getDictionary();
|
||||
String oldName = oldDictionary.getName();
|
||||
String oldType = oldDictionary.lookup(TYPE);
|
||||
String oldType = oldDictionary.lookup(selector);
|
||||
|
||||
// System.out.println("DictionaryPanelBuilder.selectDictionary() OLD TYPE: "+oldType+" OLD NAME: "+oldName);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,28 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.dictionary.model;
|
||||
|
||||
import eu.engys.core.dictionary.model.DictionaryModel.DictionaryListener;
|
||||
|
|
|
|||
|
|
@ -1,28 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.dictionary.model;
|
||||
|
||||
public enum EventActionType {
|
||||
|
|
@ -39,4 +38,4 @@ public enum EventActionType {
|
|||
public void isRemove() {
|
||||
this.equals(REMOVE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,28 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
|
||||
package eu.engys.core.dictionary.model;
|
||||
|
||||
|
|
@ -123,7 +122,7 @@ public class LevelsTableAdapter extends DictionaryTableAdapter {
|
|||
for (JComponent[] row : getRowsMap().values()) {
|
||||
map.put(((IntegerField) row[1]).getIntValue(), ((DoubleField) row[0]).getDoubleValue());
|
||||
}
|
||||
return new TreeMap<Integer, Double>(map);
|
||||
return new TreeMap<>(map);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,28 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
|
||||
package eu.engys.core.dictionary.model;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,28 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
|
||||
package eu.engys.core.dictionary.model;
|
||||
|
||||
|
|
@ -42,6 +41,8 @@ import eu.engys.util.ui.textfields.StringField;
|
|||
|
||||
public class OneDictionaryPerRowTableAdapter extends DictionaryTableAdapter {
|
||||
|
||||
public static final String ROW_NAME = "one.dict.row";
|
||||
|
||||
private final int NAME_COL = 0;
|
||||
protected final String[] columnNames;
|
||||
protected final String[] columnKeys;
|
||||
|
|
@ -71,7 +72,7 @@ public class OneDictionaryPerRowTableAdapter extends DictionaryTableAdapter {
|
|||
this.dictKey = key;
|
||||
this.type = type;
|
||||
|
||||
setName("one.dict.row");
|
||||
setName(ROW_NAME);
|
||||
|
||||
if (isStaticTable()) {
|
||||
setRowHeader();
|
||||
|
|
@ -136,7 +137,7 @@ public class OneDictionaryPerRowTableAdapter extends DictionaryTableAdapter {
|
|||
for (Dictionary d : dict.getDictionaries()) {
|
||||
JComponent[] row = new JComponent[columnKeys.length + 1];
|
||||
if (isStaticTable())
|
||||
row[0] = new JLabel(rowKeys[rowIndex]);
|
||||
row[0] = new JLabel(rowNames[rowIndex]);
|
||||
else
|
||||
row[0] = new StringField(d.getName());
|
||||
|
||||
|
|
|
|||
|
|
@ -1,28 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
|
||||
package eu.engys.core.dictionary.model;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,28 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.dictionary.model;
|
||||
|
||||
import java.awt.Color;
|
||||
|
|
@ -61,4 +60,4 @@ public class PointInfo {
|
|||
return color;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,28 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
|
||||
package eu.engys.core.dictionary.model;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,29 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.dictionary.model;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
|
|
@ -33,80 +31,81 @@ import java.beans.PropertyChangeListener;
|
|||
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.AbstractButton;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JToggleButton;
|
||||
|
||||
import net.java.dev.designgridlayout.Componentizer;
|
||||
import eu.engys.util.ui.ResourcesUtil;
|
||||
import eu.engys.util.ui.textfields.DoubleField;
|
||||
import net.java.dev.designgridlayout.Componentizer;
|
||||
|
||||
public class ShowAxisAdapter extends JPanel {
|
||||
|
||||
private static final ImageIcon ICON_ON = new ImageIcon(AbstractTableAdapter.class.getClassLoader().getResource("eu/engys/resources/images/lightbulb16.png"));
|
||||
private static final ImageIcon ICON_OFF = new ImageIcon(AbstractTableAdapter.class.getClassLoader().getResource("eu/engys/resources/images/lightbulb_off16.png"));
|
||||
private static final Icon ICON_ON = ResourcesUtil.getIcon("light.on.icon");
|
||||
private static final Icon ICON_OFF = ResourcesUtil.getIcon("light.off.icon");
|
||||
|
||||
private JToggleButton button;
|
||||
private DoubleField[] axis;
|
||||
private DoubleField[] centre;
|
||||
private JToggleButton button;
|
||||
private DoubleField[] axis;
|
||||
private DoubleField[] centre;
|
||||
|
||||
public ShowAxisAdapter(DoubleField[] axis, DoubleField[] centre) {
|
||||
super(new BorderLayout());
|
||||
this.axis = axis;
|
||||
this.centre = centre;
|
||||
this.button = newShowAxisButton(false);
|
||||
JComponent component = Componentizer.create().minAndMore(centre).minToPref(button).component();
|
||||
add(component, BorderLayout.CENTER);
|
||||
}
|
||||
public ShowAxisAdapter(DoubleField[] axis, DoubleField[] centre) {
|
||||
super(new BorderLayout());
|
||||
this.axis = axis;
|
||||
this.centre = centre;
|
||||
this.button = newShowAxisButton(false);
|
||||
JComponent component = Componentizer.create().minAndMore(centre).minToPref(button).component();
|
||||
add(component, BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setName(String name) {
|
||||
super.setName(name);
|
||||
button.setName(getName()+".button");
|
||||
axis[0].setName(getName()+".axis.0");
|
||||
axis[1].setName(getName()+".axis.1");
|
||||
axis[2].setName(getName()+".axis.2");
|
||||
centre[0].setName(getName()+".centre.0");
|
||||
centre[1].setName(getName()+".centre.1");
|
||||
centre[2].setName(getName()+".centre.2");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
|
||||
super.addPropertyChangeListener(propertyName, listener);
|
||||
if (propertyName.equals("point.location")) {
|
||||
button.getAction().addPropertyChangeListener(listener);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void setName(String name) {
|
||||
super.setName(name);
|
||||
button.setName(getName() + ".button");
|
||||
axis[0].setName(getName() + ".axis.0");
|
||||
axis[1].setName(getName() + ".axis.1");
|
||||
axis[2].setName(getName() + ".axis.2");
|
||||
centre[0].setName(getName() + ".centre.0");
|
||||
centre[1].setName(getName() + ".centre.1");
|
||||
centre[2].setName(getName() + ".centre.2");
|
||||
}
|
||||
|
||||
public void turnOff() {
|
||||
if (button.isSelected()) {
|
||||
button.doClick();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
|
||||
super.addPropertyChangeListener(propertyName, listener);
|
||||
if (propertyName.equals("point.location")) {
|
||||
button.getAction().addPropertyChangeListener(listener);
|
||||
}
|
||||
}
|
||||
|
||||
public JToggleButton newShowAxisButton(boolean selected) {
|
||||
final JToggleButton button = new JToggleButton(new AbstractAction() {
|
||||
// private Border originalBorder;
|
||||
public void turnOff() {
|
||||
if (button.isSelected()) {
|
||||
button.doClick();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
AbstractButton b = ((AbstractButton) e.getSource());
|
||||
if (b.isSelected()) {
|
||||
firePropertyChange(PointInfo.PROPERTY_NAME, null, new AxisInfo(axis, centre, EventActionType.SHOW));
|
||||
} else {
|
||||
firePropertyChange(PointInfo.PROPERTY_NAME, null, new AxisInfo(axis, centre, EventActionType.HIDE));
|
||||
}
|
||||
}
|
||||
});
|
||||
if (selected && !button.isSelected() || (!selected && button.isSelected())) {
|
||||
button.doClick();
|
||||
}
|
||||
button.setPreferredSize(new Dimension(22, 22));
|
||||
button.setIcon(ICON_OFF);
|
||||
button.setSelectedIcon(ICON_ON);
|
||||
button.setToolTipText("Click to display this point in the 3D canvas");
|
||||
return button;
|
||||
}
|
||||
public JToggleButton newShowAxisButton(boolean selected) {
|
||||
final JToggleButton button = new JToggleButton(new AbstractAction() {
|
||||
// private Border originalBorder;
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
AbstractButton b = ((AbstractButton) e.getSource());
|
||||
if (b.isSelected()) {
|
||||
firePropertyChange(PointInfo.PROPERTY_NAME, null, new AxisInfo(axis, centre, 1, EventActionType.SHOW));
|
||||
} else {
|
||||
firePropertyChange(PointInfo.PROPERTY_NAME, null, new AxisInfo(axis, centre, 1, EventActionType.HIDE));
|
||||
}
|
||||
}
|
||||
});
|
||||
if (selected && !button.isSelected() || (!selected && button.isSelected())) {
|
||||
button.doClick();
|
||||
}
|
||||
button.setPreferredSize(new Dimension(22, 22));
|
||||
button.setIcon(ICON_OFF);
|
||||
button.setSelectedIcon(ICON_ON);
|
||||
button.setToolTipText("Click to display this point in the 3D canvas");
|
||||
return button;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,28 +1,27 @@
|
|||
/*--------------------------------*- Java -*---------------------------------*\
|
||||
| o |
|
||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
| o o | http://www.engys.com |
|
||||
| o | |
|
||||
|---------------------------------------------------------------------------|
|
||||
| License |
|
||||
| This file is part of HelyxOS. |
|
||||
| |
|
||||
| HelyxOS 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 2 of the License, or (at your |
|
||||
| option) any later version. |
|
||||
| |
|
||||
| HelyxOS 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 HelyxOS; if not, write to the Free Software Foundation, |
|
||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*******************************************************************************
|
||||
* | o |
|
||||
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||
* | o o | http://www.engys.com |
|
||||
* | o | |
|
||||
* |---------------------------------------------------------------------------|
|
||||
* | License |
|
||||
* | This file is part of HELYX-OS. |
|
||||
* | |
|
||||
* | HELYX-OS 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 2 of the License, or (at your |
|
||||
* | option) any later version. |
|
||||
* | |
|
||||
* | HELYX-OS 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 HELYX-OS; if not, write to the Free Software Foundation, |
|
||||
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||
*******************************************************************************/
|
||||
package eu.engys.core.dictionary.model;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
|
|
@ -33,22 +32,24 @@ import java.beans.PropertyChangeListener;
|
|||
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.AbstractButton;
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JToggleButton;
|
||||
import javax.swing.border.Border;
|
||||
|
||||
import net.java.dev.designgridlayout.Componentizer;
|
||||
import eu.engys.util.ColorUtil;
|
||||
import eu.engys.util.ui.ResourcesUtil;
|
||||
import eu.engys.util.ui.textfields.DoubleField;
|
||||
import net.java.dev.designgridlayout.Componentizer;
|
||||
|
||||
public class ShowLocationAdapter extends JPanel {
|
||||
|
||||
private static final Icon ICON_ON = ResourcesUtil.getResourceIcon("eu/engys/resources/images/lightbulb16.png");
|
||||
private static final Icon ICON_OFF = ResourcesUtil.getResourceIcon("eu/engys/resources/images/lightbulb_off16.png");
|
||||
private static final Icon ICON_ON = ResourcesUtil.getIcon("light.on.icon");
|
||||
private static final Icon ICON_OFF = ResourcesUtil.getIcon("light.off.icon");
|
||||
|
||||
public static final String X = "x";
|
||||
public static final String Y = "y";
|
||||
public static final String Z = "z";
|
||||
|
||||
private JToggleButton button;
|
||||
private DoubleField[] fields;
|
||||
|
|
@ -57,50 +58,35 @@ public class ShowLocationAdapter extends JPanel {
|
|||
super(new BorderLayout());
|
||||
this.fields = fields;
|
||||
this.button = newShowPointButton(fields, key, false);
|
||||
|
||||
fields[0].setName(X);
|
||||
fields[1].setName(Y);
|
||||
fields[2].setName(Z);
|
||||
|
||||
JComponent component = Componentizer.create().minAndMore(fields).minToPref(button).component();
|
||||
add(component, BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
|
||||
super.addPropertyChangeListener(propertyName, listener);
|
||||
if (propertyName.equals(PointInfo.PROPERTY_NAME)) {
|
||||
button.getAction().addPropertyChangeListener(listener);
|
||||
}
|
||||
}
|
||||
|
||||
public void turnMaterialPointsOn() {
|
||||
if (!button.isSelected()) {
|
||||
button.doClick();
|
||||
}
|
||||
}
|
||||
|
||||
public void turnMaterialPointsOff() {
|
||||
if (button.isSelected()) {
|
||||
button.doClick();
|
||||
}
|
||||
}
|
||||
|
||||
public static JToggleButton newShowPointButton(final DoubleField[] locationInMesh, int index, boolean selected) {
|
||||
return newShowPointButton(locationInMesh, ColorUtil.getColor(index), selected);
|
||||
}
|
||||
|
||||
public static JToggleButton newShowPointButton(final DoubleField[] locationInMesh, final Color color, boolean selected) {
|
||||
private static JToggleButton newShowPointButton(final DoubleField[] locationInMesh, final Color color, boolean selected) {
|
||||
final JToggleButton button = new JToggleButton(new AbstractAction() {
|
||||
private Border originalBorder;
|
||||
Object originalColorProperty = new JToggleButton().getClientProperty("Synthetica.background");
|
||||
Object originalColorAlphaProperty = new JToggleButton().getClientProperty("Synthetica.background.alpha");
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
AbstractButton b = ((AbstractButton) e.getSource());
|
||||
if (b.isSelected()) {
|
||||
firePropertyChange(PointInfo.PROPERTY_NAME, null, new PointInfo(locationInMesh, color.toString(), EventActionType.SHOW, color));
|
||||
originalBorder = b.getBorder();
|
||||
b.setBorder(BorderFactory.createLineBorder(color, 2));
|
||||
b.putClientProperty("Synthetica.background", color);
|
||||
b.putClientProperty("Synthetica.background.alpha", 0.50f);
|
||||
} else {
|
||||
firePropertyChange(PointInfo.PROPERTY_NAME, null, new PointInfo(locationInMesh, color.toString(), EventActionType.HIDE, color));
|
||||
if (originalBorder != null) {
|
||||
b.setBorder(originalBorder);
|
||||
}
|
||||
b.putClientProperty("Synthetica.background", originalColorProperty);
|
||||
b.putClientProperty("Synthetica.background.alpha", originalColorAlphaProperty);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -114,6 +100,34 @@ public class ShowLocationAdapter extends JPanel {
|
|||
return button;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
|
||||
super.addPropertyChangeListener(propertyName, listener);
|
||||
if (propertyName.equals(PointInfo.PROPERTY_NAME)) {
|
||||
button.getAction().addPropertyChangeListener(listener);
|
||||
}
|
||||
}
|
||||
|
||||
public DoubleField[] getFields() {
|
||||
return fields;
|
||||
}
|
||||
|
||||
public JToggleButton getButton() {
|
||||
return button;
|
||||
}
|
||||
|
||||
public void turnMaterialPointsOn() {
|
||||
if (!button.isSelected()) {
|
||||
button.doClick();
|
||||
}
|
||||
}
|
||||
|
||||
public void turnMaterialPointsOff() {
|
||||
if (button.isSelected()) {
|
||||
button.doClick();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setToolTipText(String text) {
|
||||
super.setToolTipText(text);
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue