13 import java.awt.Frame;
14 import java.awt.event.MouseEvent;
15 import java.awt.event.MouseListener;
16 import java.awt.event.MouseMotionListener;
17 import java.awt.event.MouseWheelEvent;
18 import java.awt.event.MouseWheelListener;
20 import java.net.MalformedURLException;
22 import javax.media.opengl.awt.GLCanvas;
23 import javax.swing.JFileChooser;
28 import com.jogamp.opengl.util.Animator;
37 private float x = 0,
y = 0;
46 JFileChooser fc =
new JFileChooser();
47 fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
50 if (args != null && args.length == 1) {
51 File dir =
new File(args[0]);
52 if (dir.exists() && dir.isDirectory()) {
54 f.useModel(dir.getName());
56 throw new RuntimeException(
"Directory not found or invalid: " + args[0]);
58 }
else if (fc.showDialog(null,
"Select model directory") == JFileChooser.APPROVE_OPTION) {
59 File file = fc.getSelectedFile();
60 if (file.exists() && file.isDirectory()) {
62 f.useModel(file.getName());
66 f =
new WebModelManager(
"http://www.agh.ians.uni-stuttgart.de/jarmosa");
67 f.useModel(
"rbm_advec");
68 }
catch (MalformedURLException e) {
79 double[] par = s.getParams().getRandomParam();
80 s.getParams().setCurrent(par);
81 s.computeRBSolution(s.getNBF());
98 final Frame frame =
new java.awt.Frame(
"Model visualization");
99 frame.setSize(400, 600);
100 frame.setLayout(
new java.awt.BorderLayout());
102 final Animator animator =
new Animator();
103 frame.addWindowListener(
new java.awt.event.WindowAdapter() {
104 public void windowClosing(java.awt.event.WindowEvent e) {
108 new Thread(
new Runnable() {
117 GLCanvas canvas =
new GLCanvas();
118 animator.add(canvas);
123 canvas.addGLEventListener(rend);
125 canvas.addMouseListener(
new MouseListener() {
128 public void mouseClicked(MouseEvent e) {
129 switch (e.getButton()) {
130 case MouseEvent.BUTTON1:
131 rend.nextColorField();
133 case MouseEvent.BUTTON3:
134 rend.isFrontFace = !rend.isFrontFace;
140 public void mouseEntered(MouseEvent e) {
144 public void mouseExited(MouseEvent e) {
148 public void mousePressed(MouseEvent e) {
154 public void mouseReleased(MouseEvent e) {
160 canvas.addMouseWheelListener(
new MouseWheelListener() {
163 public void mouseWheelMoved(MouseWheelEvent e) {
164 if (e.getWheelRotation() > 0)
171 canvas.addMouseMotionListener(
new MouseMotionListener() {
174 public void mouseDragged(MouseEvent e) {
176 rend.addPos((e.getX() - x) / smooth, (
y - e.getY()) / smooth);
177 rend.isContinuousRotation =
true;
183 public void mouseMoved(MouseEvent e) {
187 frame.add(canvas, java.awt.BorderLayout.CENTER);
190 frame.setVisible(
true);
void visualize(VisualizationData vData)
This class provides the Online stage for the reduced basis method for elliptic steady state problems...
static void main(String[] args)
Represents the results of a simulation.
Manages models loaded from the file system available via the java.io classes.
Base class for RB models and systems.
This class serves as base class for accessing various types of models at different locations...
Main program for desktop-based reduced model simulation using Java.
A container class for all model visual data.
Provides the OpenGL rendering routines for the JOGL package.
A model manager reading models from a remote web location.
This Exception gets thrown when an error occurs regarding the functionality of the ModelManager...
This is a container class for all geometry-related data of a reduced model.
The color generator is used to produce RGBA (RGB+Alpha) values from a given array of floats...