adding reactions panel, work in progress
This commit is contained in:
parent
edc1fabbbd
commit
e3232940f1
6 changed files with 78 additions and 13 deletions
|
|
@ -29,6 +29,9 @@ import java.util.Set;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import eu.engys.core.dictionary.Dictionary;
|
import eu.engys.core.dictionary.Dictionary;
|
||||||
import eu.engys.core.dictionary.FieldElement;
|
import eu.engys.core.dictionary.FieldElement;
|
||||||
import eu.engys.core.modules.ApplicationModuleAdapter;
|
import eu.engys.core.modules.ApplicationModuleAdapter;
|
||||||
|
|
@ -39,13 +42,13 @@ import eu.engys.core.modules.solutionmodelling.SolutionView;
|
||||||
import eu.engys.core.modules.tree.TreeView;
|
import eu.engys.core.modules.tree.TreeView;
|
||||||
import eu.engys.core.project.Model;
|
import eu.engys.core.project.Model;
|
||||||
import eu.engys.core.project.defaults.DefaultsProvider;
|
import eu.engys.core.project.defaults.DefaultsProvider;
|
||||||
import eu.engys.core.project.state.MultiphaseModel;
|
|
||||||
import eu.engys.core.project.state.Solver;
|
import eu.engys.core.project.state.Solver;
|
||||||
import eu.engys.core.project.state.State;
|
import eu.engys.core.project.state.State;
|
||||||
import eu.engys.core.project.state.StateBuilder;
|
import eu.engys.core.project.state.StateBuilder;
|
||||||
import eu.engys.core.project.zero.fields.Fields;
|
import eu.engys.core.project.zero.fields.Fields;
|
||||||
import eu.engys.core.project.zero.fields.FieldsDefaults;
|
import eu.engys.core.project.zero.fields.FieldsDefaults;
|
||||||
import eu.engys.gui.casesetup.phases.PhasesPanel;
|
import eu.engys.gui.casesetup.phases.PhasesPanel;
|
||||||
|
import eu.engys.gui.casesetup.reactions.ReactionsPanel;
|
||||||
|
|
||||||
public class CombustionModule extends ApplicationModuleAdapter {
|
public class CombustionModule extends ApplicationModuleAdapter {
|
||||||
|
|
||||||
|
|
@ -59,6 +62,7 @@ public class CombustionModule extends ApplicationModuleAdapter {
|
||||||
private CombustionSolutionView solutionView;
|
private CombustionSolutionView solutionView;
|
||||||
private CombustionBoundaryConditionsView boundaryConditionsView;
|
private CombustionBoundaryConditionsView boundaryConditionsView;
|
||||||
|
|
||||||
|
private ReactionsPanel reactionsPanel;
|
||||||
private TreeView treeView;
|
private TreeView treeView;
|
||||||
|
|
||||||
private double sigma;
|
private double sigma;
|
||||||
|
|
@ -74,7 +78,8 @@ public class CombustionModule extends ApplicationModuleAdapter {
|
||||||
this.solutionView = new CombustionSolutionView(this);
|
this.solutionView = new CombustionSolutionView(this);
|
||||||
this.boundaryConditionsView = new CombustionBoundaryConditionsView(this);
|
this.boundaryConditionsView = new CombustionBoundaryConditionsView(this);
|
||||||
|
|
||||||
this.treeView = new CombustionTreeView(this, null);
|
this.reactionsPanel = new ReactionsPanel(model, new CombustionReactionsView(this, model));
|
||||||
|
this.treeView = new CombustionTreeView(this, reactionsPanel);
|
||||||
|
|
||||||
this.reader = new CombustionReader(model, this);
|
this.reader = new CombustionReader(model, this);
|
||||||
|
|
||||||
|
|
@ -162,8 +167,19 @@ public class CombustionModule extends ApplicationModuleAdapter {
|
||||||
return boundaryConditionsView;
|
return boundaryConditionsView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setReacting(boolean reacting) {
|
||||||
|
Logger logger = LoggerFactory.getLogger(CombustionReactionsView.class);
|
||||||
|
|
||||||
|
logger.debug("setting reacting on");
|
||||||
|
|
||||||
|
if (model != null && model.getState() != null) {
|
||||||
|
logger.debug("setting reacting done");
|
||||||
|
model.getState().setReacting(reacting);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isReacting() {
|
public boolean isReacting() {
|
||||||
return false;
|
return model.getState().isReacting();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSigma(double sigma) {
|
public void setSigma(double sigma) {
|
||||||
|
|
|
||||||
|
|
@ -34,14 +34,15 @@ import eu.engys.core.dictionary.DimensionedScalar;
|
||||||
import eu.engys.core.dictionary.model.DictionaryModel;
|
import eu.engys.core.dictionary.model.DictionaryModel;
|
||||||
import eu.engys.core.project.Model;
|
import eu.engys.core.project.Model;
|
||||||
import eu.engys.gui.casesetup.phases.PhasesView;
|
import eu.engys.gui.casesetup.phases.PhasesView;
|
||||||
|
import eu.engys.gui.casesetup.reactions.ReactionsView;
|
||||||
import eu.engys.util.DimensionalUnits;
|
import eu.engys.util.DimensionalUnits;
|
||||||
import eu.engys.util.ui.builder.PanelBuilder;
|
import eu.engys.util.ui.builder.PanelBuilder;
|
||||||
|
|
||||||
public class CombustionPhasesView implements PhasesView {
|
public class CombustionReactionsView implements ReactionsView {
|
||||||
|
|
||||||
public static final String SURFACE_TENSION_LABEL = "Surface Tension [N/m]";
|
public static final String SURFACE_TENSION_LABEL = "Surface Tension [N/m]";
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(CombustionPhasesView.class);
|
private static final Logger logger = LoggerFactory.getLogger(CombustionReactionsView.class);
|
||||||
|
|
||||||
private Model model;
|
private Model model;
|
||||||
private CombustionModule module;
|
private CombustionModule module;
|
||||||
|
|
@ -49,7 +50,7 @@ public class CombustionPhasesView implements PhasesView {
|
||||||
|
|
||||||
private PanelBuilder parametersBuilder;
|
private PanelBuilder parametersBuilder;
|
||||||
|
|
||||||
public CombustionPhasesView(CombustionModule module, Model model) {
|
public CombustionReactionsView(CombustionModule module, Model model) {
|
||||||
this.module = module;
|
this.module = module;
|
||||||
this.model = model;
|
this.model = model;
|
||||||
}
|
}
|
||||||
|
|
@ -26,6 +26,7 @@ package eu.engys.combustion;
|
||||||
|
|
||||||
import java.awt.BorderLayout;
|
import java.awt.BorderLayout;
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -52,6 +53,7 @@ public class CombustionSolutionView extends AbstractSolutionView {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(CombustionSolutionView.class);
|
private static final Logger logger = LoggerFactory.getLogger(CombustionSolutionView.class);
|
||||||
|
|
||||||
private CombustionModule module;
|
private CombustionModule module;
|
||||||
|
private ActionListener listener;
|
||||||
private PanelBuilder builder;
|
private PanelBuilder builder;
|
||||||
|
|
||||||
private JCheckBox reaction;
|
private JCheckBox reaction;
|
||||||
|
|
@ -99,6 +101,8 @@ public class CombustionSolutionView extends AbstractSolutionView {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fixThermal(SolutionState ss, ThermalState ts) {
|
public void fixThermal(SolutionState ss, ThermalState ts) {
|
||||||
|
module.setReacting(ts.isReacting());
|
||||||
|
|
||||||
if (ss.areSolverTypeAndTimeAndFlowAndTurbulenceChoosen()) {
|
if (ss.areSolverTypeAndTimeAndFlowAndTurbulenceChoosen()) {
|
||||||
if (ss.isCoupled()) {
|
if (ss.isCoupled()) {
|
||||||
if (reaction.isSelected()) {
|
if (reaction.isSelected()) {
|
||||||
|
|
@ -137,5 +141,26 @@ public class CombustionSolutionView extends AbstractSolutionView {
|
||||||
modelsCombo.setSelectedItem(selectedItem);
|
modelsCombo.setSelectedItem(selectedItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setThermalListener(ActionListener listener) {
|
||||||
|
this.listener = listener;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
@Override
|
||||||
|
public void addThermalListener() {
|
||||||
|
reaction.addActionListener(listener);
|
||||||
|
modelsCombo.addActionListener(listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeThermalListener() {
|
||||||
|
reaction.removeActionListener(listener);
|
||||||
|
modelsCombo.removeActionListener(listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateThermalState(ThermalState ts) {
|
||||||
|
ts.setReacting(reaction.isSelected());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -28,23 +28,24 @@ import eu.engys.core.modules.ModulePanel;
|
||||||
import eu.engys.core.modules.tree.AbstractTreeViewAdapter;
|
import eu.engys.core.modules.tree.AbstractTreeViewAdapter;
|
||||||
import eu.engys.core.modules.tree.ModuleElementPanel;
|
import eu.engys.core.modules.tree.ModuleElementPanel;
|
||||||
import eu.engys.gui.casesetup.phases.PhasesPanel;
|
import eu.engys.gui.casesetup.phases.PhasesPanel;
|
||||||
|
import eu.engys.gui.casesetup.reactions.ReactionsPanel;
|
||||||
|
|
||||||
public class CombustionTreeView extends AbstractTreeViewAdapter {
|
public class CombustionTreeView extends AbstractTreeViewAdapter {
|
||||||
|
|
||||||
private CombustionModule module;
|
private CombustionModule module;
|
||||||
private ModulePanel phasesPanel;
|
private ModulePanel reactionsPanel;
|
||||||
|
|
||||||
public CombustionTreeView(CombustionModule module, PhasesPanel phasesPanel) {
|
public CombustionTreeView(CombustionModule module, ReactionsPanel reactionsPanel) {
|
||||||
this.module = module;
|
this.module = module;
|
||||||
this.phasesPanel = phasesPanel;
|
this.reactionsPanel = reactionsPanel;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateCaseSetupTree(ModuleElementPanel viewElementPanel) {
|
public void updateCaseSetupTree(ModuleElementPanel viewElementPanel) {
|
||||||
if (module.isReacting()) {
|
if (module.isReacting()) {
|
||||||
viewElementPanel.addPanel(phasesPanel);
|
viewElementPanel.addPanel(reactionsPanel);
|
||||||
} else {
|
} else {
|
||||||
viewElementPanel.removePanel(phasesPanel);
|
viewElementPanel.removePanel(reactionsPanel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@ public class State {
|
||||||
private boolean buoyant;
|
private boolean buoyant;
|
||||||
private boolean radiation;
|
private boolean radiation;
|
||||||
private boolean solar;
|
private boolean solar;
|
||||||
|
private boolean reacting;
|
||||||
|
|
||||||
private boolean adjoint;
|
private boolean adjoint;
|
||||||
|
|
||||||
|
|
@ -213,6 +214,14 @@ public class State {
|
||||||
public boolean isSolar() {
|
public boolean isSolar() {
|
||||||
return solar;
|
return solar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setReacting(boolean reacting) {
|
||||||
|
this.reacting = reacting;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isReacting() {
|
||||||
|
return reacting;
|
||||||
|
}
|
||||||
|
|
||||||
public void setAdjoint(boolean adjoint) {
|
public void setAdjoint(boolean adjoint) {
|
||||||
this.adjoint = adjoint;
|
this.adjoint = adjoint;
|
||||||
|
|
|
||||||
|
|
@ -29,17 +29,20 @@ public class ThermalState {
|
||||||
public static final String THERMAL = "Thermal";
|
public static final String THERMAL = "Thermal";
|
||||||
public static final String ENERGY = "Energy";
|
public static final String ENERGY = "Energy";
|
||||||
public static final String BUOYANCY = "Buoyancy";
|
public static final String BUOYANCY = "Buoyancy";
|
||||||
|
public static final String REACTING = "Reacting";
|
||||||
|
|
||||||
private boolean energy;
|
private boolean energy;
|
||||||
private boolean buoyancy;
|
private boolean buoyancy;
|
||||||
private boolean radiation;
|
private boolean radiation;
|
||||||
private boolean solar;
|
private boolean solar;
|
||||||
|
private boolean reacting;
|
||||||
|
|
||||||
public ThermalState() {
|
public ThermalState() {
|
||||||
this.setEnergy(false);
|
this.setEnergy(false);
|
||||||
this.setBuoyancy(false);
|
this.setBuoyancy(false);
|
||||||
this.setBuoyancy(false);
|
this.setBuoyancy(false);
|
||||||
this.setSolar(false);
|
this.setSolar(false);
|
||||||
|
this.setReacting(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ThermalState(State state) {
|
public ThermalState(State state) {
|
||||||
|
|
@ -47,6 +50,7 @@ public class ThermalState {
|
||||||
this.setBuoyancy(state.isBuoyant());
|
this.setBuoyancy(state.isBuoyant());
|
||||||
this.setRadiation(state.isRadiation());
|
this.setRadiation(state.isRadiation());
|
||||||
this.setSolar(state.isSolar());
|
this.setSolar(state.isSolar());
|
||||||
|
this.setReacting(state.isReacting());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isEnergy() {
|
public boolean isEnergy() {
|
||||||
|
|
@ -81,8 +85,17 @@ public class ThermalState {
|
||||||
this.solar = solar;
|
this.solar = solar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isReacting() {
|
||||||
|
return reacting;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReacting(boolean reacting) {
|
||||||
|
this.reacting = reacting;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Energy: " + (isEnergy() ? "ON" : "OFF") + ", Buoyancy: " + (isBuoyancy() ? "ON" : "OFF") + ", Radiation: " + (isRadiation() ? "ON" : "OFF") + ", Solar: " + (isSolar() ? "ON" : "OFF");
|
return "Energy: " + (isEnergy() ? "ON" : "OFF") + ", Buoyancy: " + (isBuoyancy() ? "ON" : "OFF") + ", Radiation: " + (isRadiation() ? "ON" : "OFF") + ", Solar: " + (isSolar() ? "ON" : "OFF")
|
||||||
|
+ ", Reacting: " + (isReacting() ? "ON" : "OFF");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Reference in a new issue