Compare commits
26 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
26e94bdcf1 | ||
|
|
1b6c546d43 | ||
|
|
e3232940f1 | ||
|
|
edc1fabbbd | ||
|
|
bd679dea07 | ||
|
|
ab7ba4b4b5 | ||
|
|
971abb25f9 | ||
|
|
3b082dded2 | ||
|
|
c597ab5b4a | ||
|
|
d68e52e564 | ||
|
|
f457c8b3af | ||
|
|
1b8b0002b6 | ||
|
|
dcf0f15cee | ||
|
|
f369370fc2 | ||
|
|
471490caaf | ||
|
|
f921c0ea12 | ||
|
|
a2f0a3b776 | ||
|
|
b658f2e87f | ||
|
|
551a175115 | ||
|
|
124a05fc4b | ||
|
|
d31777b4a0 | ||
|
|
7feac6c6c8 | ||
|
|
d41f2b6c99 | ||
|
|
f239828cd6 | ||
|
|
ac48d9c444 | ||
|
|
b000ad05ef |
1357 changed files with 73156 additions and 47419 deletions
11
.gitignore
vendored
Normal file
11
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
HELYX-OS.sh
|
||||||
|
bin
|
||||||
|
dictData
|
||||||
|
ext
|
||||||
|
img
|
||||||
|
lib
|
||||||
|
.classpath
|
||||||
|
.project
|
||||||
|
build
|
||||||
|
vtkError.txt
|
||||||
|
|
||||||
11
.gitlab-ci.yml
Normal file
11
.gitlab-ci.yml
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
image: registry.gitlab.com/combustion-postech/helyx-os
|
||||||
|
|
||||||
|
allwmake:
|
||||||
|
stage: build
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
script:
|
||||||
|
- cd ${CI_PROJECT_DIR}
|
||||||
|
- cp -R * /root/Engys/HELYX-OS/v2.4.0
|
||||||
|
- cd /root/Engys/HELYX-OS/v2.4.0
|
||||||
|
- ant -buildfile build_src.xml
|
||||||
709
COPYING
Normal file
709
COPYING
Normal file
|
|
@ -0,0 +1,709 @@
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
|
||||||
|
HELYX-OS is Copyright (C) 2016 Engys Ltd
|
||||||
|
Contact: Engys Ltd (info@engys.com)
|
||||||
|
|
||||||
|
You may use, distribute and copy the HELYX-OS CFD Toolbox under the terms
|
||||||
|
of GNU General Public License version 3, which is displayed below, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------
|
||||||
|
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The GNU General Public License is a free, copyleft license for
|
||||||
|
software and other kinds of works.
|
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed
|
||||||
|
to take away your freedom to share and change the works. By contrast,
|
||||||
|
the GNU General Public License is intended to guarantee your freedom to
|
||||||
|
share and change all versions of a program--to make sure it remains free
|
||||||
|
software for all its users. We, the Free Software Foundation, use the
|
||||||
|
GNU General Public License for most of our software; it applies also to
|
||||||
|
any other work released this way by its authors. You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
them if you wish), that you receive source code or can get it if you
|
||||||
|
want it, that you can change the software or use pieces of it in new
|
||||||
|
free programs, and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to prevent others from denying you
|
||||||
|
these rights or asking you to surrender the rights. Therefore, you have
|
||||||
|
certain responsibilities if you distribute copies of the software, or if
|
||||||
|
you modify it: responsibilities to respect the freedom of others.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must pass on to the recipients the same
|
||||||
|
freedoms that you received. You must make sure that they, too, receive
|
||||||
|
or can get the source code. And you must show them these terms so they
|
||||||
|
know their rights.
|
||||||
|
|
||||||
|
Developers that use the GNU GPL protect your rights with two steps:
|
||||||
|
(1) assert copyright on the software, and (2) offer you this License
|
||||||
|
giving you legal permission to copy, distribute and/or modify it.
|
||||||
|
|
||||||
|
For the developers' and authors' protection, the GPL clearly explains
|
||||||
|
that there is no warranty for this free software. For both users' and
|
||||||
|
authors' sake, the GPL requires that modified versions be marked as
|
||||||
|
changed, so that their problems will not be attributed erroneously to
|
||||||
|
authors of previous versions.
|
||||||
|
|
||||||
|
Some devices are designed to deny users access to install or run
|
||||||
|
modified versions of the software inside them, although the manufacturer
|
||||||
|
can do so. This is fundamentally incompatible with the aim of
|
||||||
|
protecting users' freedom to change the software. The systematic
|
||||||
|
pattern of such abuse occurs in the area of products for individuals to
|
||||||
|
use, which is precisely where it is most unacceptable. Therefore, we
|
||||||
|
have designed this version of the GPL to prohibit the practice for those
|
||||||
|
products. If such problems arise substantially in other domains, we
|
||||||
|
stand ready to extend this provision to those domains in future versions
|
||||||
|
of the GPL, as needed to protect the freedom of users.
|
||||||
|
|
||||||
|
Finally, every program is threatened constantly by software patents.
|
||||||
|
States should not allow patents to restrict development and use of
|
||||||
|
software on general-purpose computers, but in those that do, we wish to
|
||||||
|
avoid the special danger that patents applied to a free program could
|
||||||
|
make it effectively proprietary. To prevent this, the GPL assures that
|
||||||
|
patents cannot be used to render the program non-free.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
0. Definitions.
|
||||||
|
|
||||||
|
"This License" refers to version 3 of the GNU General Public License.
|
||||||
|
|
||||||
|
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||||
|
works, such as semiconductor masks.
|
||||||
|
|
||||||
|
"The Program" refers to any copyrightable work licensed under this
|
||||||
|
License. Each licensee is addressed as "you". "Licensees" and
|
||||||
|
"recipients" may be individuals or organizations.
|
||||||
|
|
||||||
|
To "modify" a work means to copy from or adapt all or part of the work
|
||||||
|
in a fashion requiring copyright permission, other than the making of an
|
||||||
|
exact copy. The resulting work is called a "modified version" of the
|
||||||
|
earlier work or a work "based on" the earlier work.
|
||||||
|
|
||||||
|
A "covered work" means either the unmodified Program or a work based
|
||||||
|
on the Program.
|
||||||
|
|
||||||
|
To "propagate" a work means to do anything with it that, without
|
||||||
|
permission, would make you directly or secondarily liable for
|
||||||
|
infringement under applicable copyright law, except executing it on a
|
||||||
|
computer or modifying a private copy. Propagation includes copying,
|
||||||
|
distribution (with or without modification), making available to the
|
||||||
|
public, and in some countries other activities as well.
|
||||||
|
|
||||||
|
To "convey" a work means any kind of propagation that enables other
|
||||||
|
parties to make or receive copies. Mere interaction with a user through
|
||||||
|
a computer network, with no transfer of a copy, is not conveying.
|
||||||
|
|
||||||
|
An interactive user interface displays "Appropriate Legal Notices"
|
||||||
|
to the extent that it includes a convenient and prominently visible
|
||||||
|
feature that (1) displays an appropriate copyright notice, and (2)
|
||||||
|
tells the user that there is no warranty for the work (except to the
|
||||||
|
extent that warranties are provided), that licensees may convey the
|
||||||
|
work under this License, and how to view a copy of this License. If
|
||||||
|
the interface presents a list of user commands or options, such as a
|
||||||
|
menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
|
1. Source Code.
|
||||||
|
|
||||||
|
The "source code" for a work means the preferred form of the work
|
||||||
|
for making modifications to it. "Object code" means any non-source
|
||||||
|
form of a work.
|
||||||
|
|
||||||
|
A "Standard Interface" means an interface that either is an official
|
||||||
|
standard defined by a recognized standards body, or, in the case of
|
||||||
|
interfaces specified for a particular programming language, one that
|
||||||
|
is widely used among developers working in that language.
|
||||||
|
|
||||||
|
The "System Libraries" of an executable work include anything, other
|
||||||
|
than the work as a whole, that (a) is included in the normal form of
|
||||||
|
packaging a Major Component, but which is not part of that Major
|
||||||
|
Component, and (b) serves only to enable use of the work with that
|
||||||
|
Major Component, or to implement a Standard Interface for which an
|
||||||
|
implementation is available to the public in source code form. A
|
||||||
|
"Major Component", in this context, means a major essential component
|
||||||
|
(kernel, window system, and so on) of the specific operating system
|
||||||
|
(if any) on which the executable work runs, or a compiler used to
|
||||||
|
produce the work, or an object code interpreter used to run it.
|
||||||
|
|
||||||
|
The "Corresponding Source" for a work in object code form means all
|
||||||
|
the source code needed to generate, install, and (for an executable
|
||||||
|
work) run the object code and to modify the work, including scripts to
|
||||||
|
control those activities. However, it does not include the work's
|
||||||
|
System Libraries, or general-purpose tools or generally available free
|
||||||
|
programs which are used unmodified in performing those activities but
|
||||||
|
which are not part of the work. For example, Corresponding Source
|
||||||
|
includes interface definition files associated with source files for
|
||||||
|
the work, and the source code for shared libraries and dynamically
|
||||||
|
linked subprograms that the work is specifically designed to require,
|
||||||
|
such as by intimate data communication or control flow between those
|
||||||
|
subprograms and other parts of the work.
|
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users
|
||||||
|
can regenerate automatically from other parts of the Corresponding
|
||||||
|
Source.
|
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that
|
||||||
|
same work.
|
||||||
|
|
||||||
|
2. Basic Permissions.
|
||||||
|
|
||||||
|
All rights granted under this License are granted for the term of
|
||||||
|
copyright on the Program, and are irrevocable provided the stated
|
||||||
|
conditions are met. This License explicitly affirms your unlimited
|
||||||
|
permission to run the unmodified Program. The output from running a
|
||||||
|
covered work is covered by this License only if the output, given its
|
||||||
|
content, constitutes a covered work. This License acknowledges your
|
||||||
|
rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not
|
||||||
|
convey, without conditions so long as your license otherwise remains
|
||||||
|
in force. You may convey covered works to others for the sole purpose
|
||||||
|
of having them make modifications exclusively for you, or provide you
|
||||||
|
with facilities for running those works, provided that you comply with
|
||||||
|
the terms of this License in conveying all material for which you do
|
||||||
|
not control copyright. Those thus making or running the covered works
|
||||||
|
for you must do so exclusively on your behalf, under your direction
|
||||||
|
and control, on terms that prohibit them from making any copies of
|
||||||
|
your copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under
|
||||||
|
the conditions stated below. Sublicensing is not allowed; section 10
|
||||||
|
makes it unnecessary.
|
||||||
|
|
||||||
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
|
||||||
|
No covered work shall be deemed part of an effective technological
|
||||||
|
measure under any applicable law fulfilling obligations under article
|
||||||
|
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||||
|
similar laws prohibiting or restricting circumvention of such
|
||||||
|
measures.
|
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid
|
||||||
|
circumvention of technological measures to the extent such circumvention
|
||||||
|
is effected by exercising rights under this License with respect to
|
||||||
|
the covered work, and you disclaim any intention to limit operation or
|
||||||
|
modification of the work as a means of enforcing, against the work's
|
||||||
|
users, your or third parties' legal rights to forbid circumvention of
|
||||||
|
technological measures.
|
||||||
|
|
||||||
|
4. Conveying Verbatim Copies.
|
||||||
|
|
||||||
|
You may convey verbatim copies of the Program's source code as you
|
||||||
|
receive it, in any medium, provided that you conspicuously and
|
||||||
|
appropriately publish on each copy an appropriate copyright notice;
|
||||||
|
keep intact all notices stating that this License and any
|
||||||
|
non-permissive terms added in accord with section 7 apply to the code;
|
||||||
|
keep intact all notices of the absence of any warranty; and give all
|
||||||
|
recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey,
|
||||||
|
and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
5. Conveying Modified Source Versions.
|
||||||
|
|
||||||
|
You may convey a work based on the Program, or the modifications to
|
||||||
|
produce it from the Program, in the form of source code under the
|
||||||
|
terms of section 4, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The work must carry prominent notices stating that you modified
|
||||||
|
it, and giving a relevant date.
|
||||||
|
|
||||||
|
b) The work must carry prominent notices stating that it is
|
||||||
|
released under this License and any conditions added under section
|
||||||
|
7. This requirement modifies the requirement in section 4 to
|
||||||
|
"keep intact all notices".
|
||||||
|
|
||||||
|
c) You must license the entire work, as a whole, under this
|
||||||
|
License to anyone who comes into possession of a copy. This
|
||||||
|
License will therefore apply, along with any applicable section 7
|
||||||
|
additional terms, to the whole of the work, and all its parts,
|
||||||
|
regardless of how they are packaged. This License gives no
|
||||||
|
permission to license the work in any other way, but it does not
|
||||||
|
invalidate such permission if you have separately received it.
|
||||||
|
|
||||||
|
d) If the work has interactive user interfaces, each must display
|
||||||
|
Appropriate Legal Notices; however, if the Program has interactive
|
||||||
|
interfaces that do not display Appropriate Legal Notices, your
|
||||||
|
work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent
|
||||||
|
works, which are not by their nature extensions of the covered work,
|
||||||
|
and which are not combined with it such as to form a larger program,
|
||||||
|
in or on a volume of a storage or distribution medium, is called an
|
||||||
|
"aggregate" if the compilation and its resulting copyright are not
|
||||||
|
used to limit the access or legal rights of the compilation's users
|
||||||
|
beyond what the individual works permit. Inclusion of a covered work
|
||||||
|
in an aggregate does not cause this License to apply to the other
|
||||||
|
parts of the aggregate.
|
||||||
|
|
||||||
|
6. Conveying Non-Source Forms.
|
||||||
|
|
||||||
|
You may convey a covered work in object code form under the terms
|
||||||
|
of sections 4 and 5, provided that you also convey the
|
||||||
|
machine-readable Corresponding Source under the terms of this License,
|
||||||
|
in one of these ways:
|
||||||
|
|
||||||
|
a) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by the
|
||||||
|
Corresponding Source fixed on a durable physical medium
|
||||||
|
customarily used for software interchange.
|
||||||
|
|
||||||
|
b) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by a
|
||||||
|
written offer, valid for at least three years and valid for as
|
||||||
|
long as you offer spare parts or customer support for that product
|
||||||
|
model, to give anyone who possesses the object code either (1) a
|
||||||
|
copy of the Corresponding Source for all the software in the
|
||||||
|
product that is covered by this License, on a durable physical
|
||||||
|
medium customarily used for software interchange, for a price no
|
||||||
|
more than your reasonable cost of physically performing this
|
||||||
|
conveying of source, or (2) access to copy the
|
||||||
|
Corresponding Source from a network server at no charge.
|
||||||
|
|
||||||
|
c) Convey individual copies of the object code with a copy of the
|
||||||
|
written offer to provide the Corresponding Source. This
|
||||||
|
alternative is allowed only occasionally and noncommercially, and
|
||||||
|
only if you received the object code with such an offer, in accord
|
||||||
|
with subsection 6b.
|
||||||
|
|
||||||
|
d) Convey the object code by offering access from a designated
|
||||||
|
place (gratis or for a charge), and offer equivalent access to the
|
||||||
|
Corresponding Source in the same way through the same place at no
|
||||||
|
further charge. You need not require recipients to copy the
|
||||||
|
Corresponding Source along with the object code. If the place to
|
||||||
|
copy the object code is a network server, the Corresponding Source
|
||||||
|
may be on a different server (operated by you or a third party)
|
||||||
|
that supports equivalent copying facilities, provided you maintain
|
||||||
|
clear directions next to the object code saying where to find the
|
||||||
|
Corresponding Source. Regardless of what server hosts the
|
||||||
|
Corresponding Source, you remain obligated to ensure that it is
|
||||||
|
available for as long as needed to satisfy these requirements.
|
||||||
|
|
||||||
|
e) Convey the object code using peer-to-peer transmission, provided
|
||||||
|
you inform other peers where the object code and Corresponding
|
||||||
|
Source of the work are being offered to the general public at no
|
||||||
|
charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded
|
||||||
|
from the Corresponding Source as a System Library, need not be
|
||||||
|
included in conveying the object code work.
|
||||||
|
|
||||||
|
A "User Product" is either (1) a "consumer product", which means any
|
||||||
|
tangible personal property which is normally used for personal, family,
|
||||||
|
or household purposes, or (2) anything designed or sold for incorporation
|
||||||
|
into a dwelling. In determining whether a product is a consumer product,
|
||||||
|
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||||
|
product received by a particular user, "normally used" refers to a
|
||||||
|
typical or common use of that class of product, regardless of the status
|
||||||
|
of the particular user or of the way in which the particular user
|
||||||
|
actually uses, or expects or is expected to use, the product. A product
|
||||||
|
is a consumer product regardless of whether the product has substantial
|
||||||
|
commercial, industrial or non-consumer uses, unless such uses represent
|
||||||
|
the only significant mode of use of the product.
|
||||||
|
|
||||||
|
"Installation Information" for a User Product means any methods,
|
||||||
|
procedures, authorization keys, or other information required to install
|
||||||
|
and execute modified versions of a covered work in that User Product from
|
||||||
|
a modified version of its Corresponding Source. The information must
|
||||||
|
suffice to ensure that the continued functioning of the modified object
|
||||||
|
code is in no case prevented or interfered with solely because
|
||||||
|
modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or
|
||||||
|
specifically for use in, a User Product, and the conveying occurs as
|
||||||
|
part of a transaction in which the right of possession and use of the
|
||||||
|
User Product is transferred to the recipient in perpetuity or for a
|
||||||
|
fixed term (regardless of how the transaction is characterized), the
|
||||||
|
Corresponding Source conveyed under this section must be accompanied
|
||||||
|
by the Installation Information. But this requirement does not apply
|
||||||
|
if neither you nor any third party retains the ability to install
|
||||||
|
modified object code on the User Product (for example, the work has
|
||||||
|
been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a
|
||||||
|
requirement to continue to provide support service, warranty, or updates
|
||||||
|
for a work that has been modified or installed by the recipient, or for
|
||||||
|
the User Product in which it has been modified or installed. Access to a
|
||||||
|
network may be denied when the modification itself materially and
|
||||||
|
adversely affects the operation of the network or violates the rules and
|
||||||
|
protocols for communication across the network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided,
|
||||||
|
in accord with this section must be in a format that is publicly
|
||||||
|
documented (and with an implementation available to the public in
|
||||||
|
source code form), and must require no special password or key for
|
||||||
|
unpacking, reading or copying.
|
||||||
|
|
||||||
|
7. Additional Terms.
|
||||||
|
|
||||||
|
"Additional permissions" are terms that supplement the terms of this
|
||||||
|
License by making exceptions from one or more of its conditions.
|
||||||
|
Additional permissions that are applicable to the entire Program shall
|
||||||
|
be treated as though they were included in this License, to the extent
|
||||||
|
that they are valid under applicable law. If additional permissions
|
||||||
|
apply only to part of the Program, that part may be used separately
|
||||||
|
under those permissions, but the entire Program remains governed by
|
||||||
|
this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option
|
||||||
|
remove any additional permissions from that copy, or from any part of
|
||||||
|
it. (Additional permissions may be written to require their own
|
||||||
|
removal in certain cases when you modify the work.) You may place
|
||||||
|
additional permissions on material, added by you to a covered work,
|
||||||
|
for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you
|
||||||
|
add to a covered work, you may (if authorized by the copyright holders of
|
||||||
|
that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
a) Disclaiming warranty or limiting liability differently from the
|
||||||
|
terms of sections 15 and 16 of this License; or
|
||||||
|
|
||||||
|
b) Requiring preservation of specified reasonable legal notices or
|
||||||
|
author attributions in that material or in the Appropriate Legal
|
||||||
|
Notices displayed by works containing it; or
|
||||||
|
|
||||||
|
c) Prohibiting misrepresentation of the origin of that material, or
|
||||||
|
requiring that modified versions of such material be marked in
|
||||||
|
reasonable ways as different from the original version; or
|
||||||
|
|
||||||
|
d) Limiting the use for publicity purposes of names of licensors or
|
||||||
|
authors of the material; or
|
||||||
|
|
||||||
|
e) Declining to grant rights under trademark law for use of some
|
||||||
|
trade names, trademarks, or service marks; or
|
||||||
|
|
||||||
|
f) Requiring indemnification of licensors and authors of that
|
||||||
|
material by anyone who conveys the material (or modified versions of
|
||||||
|
it) with contractual assumptions of liability to the recipient, for
|
||||||
|
any liability that these contractual assumptions directly impose on
|
||||||
|
those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered "further
|
||||||
|
restrictions" within the meaning of section 10. If the Program as you
|
||||||
|
received it, or any part of it, contains a notice stating that it is
|
||||||
|
governed by this License along with a term that is a further
|
||||||
|
restriction, you may remove that term. If a license document contains
|
||||||
|
a further restriction but permits relicensing or conveying under this
|
||||||
|
License, you may add to a covered work material governed by the terms
|
||||||
|
of that license document, provided that the further restriction does
|
||||||
|
not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you
|
||||||
|
must place, in the relevant source files, a statement of the
|
||||||
|
additional terms that apply to those files, or a notice indicating
|
||||||
|
where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the
|
||||||
|
form of a separately written license, or stated as exceptions;
|
||||||
|
the above requirements apply either way.
|
||||||
|
|
||||||
|
8. Termination.
|
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly
|
||||||
|
provided under this License. Any attempt otherwise to propagate or
|
||||||
|
modify it is void, and will automatically terminate your rights under
|
||||||
|
this License (including any patent licenses granted under the third
|
||||||
|
paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your
|
||||||
|
license from a particular copyright holder is reinstated (a)
|
||||||
|
provisionally, unless and until the copyright holder explicitly and
|
||||||
|
finally terminates your license, and (b) permanently, if the copyright
|
||||||
|
holder fails to notify you of the violation by some reasonable means
|
||||||
|
prior to 60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is
|
||||||
|
reinstated permanently if the copyright holder notifies you of the
|
||||||
|
violation by some reasonable means, this is the first time you have
|
||||||
|
received notice of violation of this License (for any work) from that
|
||||||
|
copyright holder, and you cure the violation prior to 30 days after
|
||||||
|
your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the
|
||||||
|
licenses of parties who have received copies or rights from you under
|
||||||
|
this License. If your rights have been terminated and not permanently
|
||||||
|
reinstated, you do not qualify to receive new licenses for the same
|
||||||
|
material under section 10.
|
||||||
|
|
||||||
|
9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or
|
||||||
|
run a copy of the Program. Ancillary propagation of a covered work
|
||||||
|
occurring solely as a consequence of using peer-to-peer transmission
|
||||||
|
to receive a copy likewise does not require acceptance. However,
|
||||||
|
nothing other than this License grants you permission to propagate or
|
||||||
|
modify any covered work. These actions infringe copyright if you do
|
||||||
|
not accept this License. Therefore, by modifying or propagating a
|
||||||
|
covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically
|
||||||
|
receives a license from the original licensors, to run, modify and
|
||||||
|
propagate that work, subject to this License. You are not responsible
|
||||||
|
for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An "entity transaction" is a transaction transferring control of an
|
||||||
|
organization, or substantially all assets of one, or subdividing an
|
||||||
|
organization, or merging organizations. If propagation of a covered
|
||||||
|
work results from an entity transaction, each party to that
|
||||||
|
transaction who receives a copy of the work also receives whatever
|
||||||
|
licenses to the work the party's predecessor in interest had or could
|
||||||
|
give under the previous paragraph, plus a right to possession of the
|
||||||
|
Corresponding Source of the work from the predecessor in interest, if
|
||||||
|
the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the
|
||||||
|
rights granted or affirmed under this License. For example, you may
|
||||||
|
not impose a license fee, royalty, or other charge for exercise of
|
||||||
|
rights granted under this License, and you may not initiate litigation
|
||||||
|
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||||
|
any patent claim is infringed by making, using, selling, offering for
|
||||||
|
sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
11. Patents.
|
||||||
|
|
||||||
|
A "contributor" is a copyright holder who authorizes use under this
|
||||||
|
License of the Program or a work on which the Program is based. The
|
||||||
|
work thus licensed is called the contributor's "contributor version".
|
||||||
|
|
||||||
|
A contributor's "essential patent claims" are all patent claims
|
||||||
|
owned or controlled by the contributor, whether already acquired or
|
||||||
|
hereafter acquired, that would be infringed by some manner, permitted
|
||||||
|
by this License, of making, using, or selling its contributor version,
|
||||||
|
but do not include claims that would be infringed only as a
|
||||||
|
consequence of further modification of the contributor version. For
|
||||||
|
purposes of this definition, "control" includes the right to grant
|
||||||
|
patent sublicenses in a manner consistent with the requirements of
|
||||||
|
this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||||
|
patent license under the contributor's essential patent claims, to
|
||||||
|
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||||
|
propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a "patent license" is any express
|
||||||
|
agreement or commitment, however denominated, not to enforce a patent
|
||||||
|
(such as an express permission to practice a patent or covenant not to
|
||||||
|
sue for patent infringement). To "grant" such a patent license to a
|
||||||
|
party means to make such an agreement or commitment not to enforce a
|
||||||
|
patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license,
|
||||||
|
and the Corresponding Source of the work is not available for anyone
|
||||||
|
to copy, free of charge and under the terms of this License, through a
|
||||||
|
publicly available network server or other readily accessible means,
|
||||||
|
then you must either (1) cause the Corresponding Source to be so
|
||||||
|
available, or (2) arrange to deprive yourself of the benefit of the
|
||||||
|
patent license for this particular work, or (3) arrange, in a manner
|
||||||
|
consistent with the requirements of this License, to extend the patent
|
||||||
|
license to downstream recipients. "Knowingly relying" means you have
|
||||||
|
actual knowledge that, but for the patent license, your conveying the
|
||||||
|
covered work in a country, or your recipient's use of the covered work
|
||||||
|
in a country, would infringe one or more identifiable patents in that
|
||||||
|
country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or
|
||||||
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||||
|
covered work, and grant a patent license to some of the parties
|
||||||
|
receiving the covered work authorizing them to use, propagate, modify
|
||||||
|
or convey a specific copy of the covered work, then the patent license
|
||||||
|
you grant is automatically extended to all recipients of the covered
|
||||||
|
work and works based on it.
|
||||||
|
|
||||||
|
A patent license is "discriminatory" if it does not include within
|
||||||
|
the scope of its coverage, prohibits the exercise of, or is
|
||||||
|
conditioned on the non-exercise of one or more of the rights that are
|
||||||
|
specifically granted under this License. You may not convey a covered
|
||||||
|
work if you are a party to an arrangement with a third party that is
|
||||||
|
in the business of distributing software, under which you make payment
|
||||||
|
to the third party based on the extent of your activity of conveying
|
||||||
|
the work, and under which the third party grants, to any of the
|
||||||
|
parties who would receive the covered work from you, a discriminatory
|
||||||
|
patent license (a) in connection with copies of the covered work
|
||||||
|
conveyed by you (or copies made from those copies), or (b) primarily
|
||||||
|
for and in connection with specific products or compilations that
|
||||||
|
contain the covered work, unless you entered into that arrangement,
|
||||||
|
or that patent license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting
|
||||||
|
any implied license or other defenses to infringement that may
|
||||||
|
otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot convey a
|
||||||
|
covered work so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you may
|
||||||
|
not convey it at all. For example, if you agree to terms that obligate you
|
||||||
|
to collect a royalty for further conveying from those to whom you convey
|
||||||
|
the Program, the only way you could satisfy both those terms and this
|
||||||
|
License would be to refrain entirely from conveying the Program.
|
||||||
|
|
||||||
|
13. Use with the GNU Affero General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have
|
||||||
|
permission to link or combine any covered work with a work licensed
|
||||||
|
under version 3 of the GNU Affero General Public License into a single
|
||||||
|
combined work, and to convey the resulting work. The terms of this
|
||||||
|
License will continue to apply to the part which is the covered work,
|
||||||
|
but the special requirements of the GNU Affero General Public License,
|
||||||
|
section 13, concerning interaction through a network will apply to the
|
||||||
|
combination as such.
|
||||||
|
|
||||||
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of
|
||||||
|
the GNU General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Program specifies that a certain numbered version of the GNU General
|
||||||
|
Public License "or any later version" applies to it, you have the
|
||||||
|
option of following the terms and conditions either of that numbered
|
||||||
|
version or of any later version published by the Free Software
|
||||||
|
Foundation. If the Program does not specify a version number of the
|
||||||
|
GNU General Public License, you may choose any version ever published
|
||||||
|
by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future
|
||||||
|
versions of the GNU General Public License can be used, that proxy's
|
||||||
|
public statement of acceptance of a version permanently authorizes you
|
||||||
|
to choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different
|
||||||
|
permissions. However, no additional obligations are imposed on any
|
||||||
|
author or copyright holder as a result of your choosing to follow a
|
||||||
|
later version.
|
||||||
|
|
||||||
|
15. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||||
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||||
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||||
|
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||||
|
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||||
|
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. Limitation of Liability.
|
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||||
|
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||||
|
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||||
|
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||||
|
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||||
|
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||||
|
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGES.
|
||||||
|
|
||||||
|
17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided
|
||||||
|
above cannot be given local legal effect according to their terms,
|
||||||
|
reviewing courts shall apply local law that most closely approximates
|
||||||
|
an absolute waiver of all civil liability in connection with the
|
||||||
|
Program, unless a warranty or assumption of liability accompanies a
|
||||||
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
state the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program does terminal interaction, make it output a short
|
||||||
|
notice like this when it starts in an interactive mode:
|
||||||
|
|
||||||
|
<program> Copyright (C) <year> <name of author>
|
||||||
|
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, your program's commands
|
||||||
|
might be different; for a GUI interface, you would use an "about box".
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or school,
|
||||||
|
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||||
|
For more information on this, and how to apply and follow the GNU GPL, see
|
||||||
|
<http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
The GNU General Public License does not permit incorporating your program
|
||||||
|
into proprietary programs. If your program is a subroutine library, you
|
||||||
|
may consider it more useful to permit linking proprietary applications with
|
||||||
|
the library. If this is what you want to do, use the GNU Lesser General
|
||||||
|
Public License instead of this License. But first, please read
|
||||||
|
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||||
|
|
||||||
|
|
||||||
|
THIRD PARTIES
|
||||||
|
|
||||||
|
The following Third Party software tools have been employed in the development of HELYX®. Copies of the corresponding software licenses are provided with this Agreement.
|
||||||
|
|
||||||
|
APACHE Commons (APACHE License), see http://www.apache.org
|
||||||
|
DesignGridLayout (APACHE License), see http://designgridlayout.java.net
|
||||||
|
Google Guice (APACHE License), see https://github.com/google/guice
|
||||||
|
iText (LGPLv3 License), see http://www.itextpdf.com
|
||||||
|
Java3D (GPLv2 + CLASSPATH exception), see http://www.java3d.java.net
|
||||||
|
JCraft (BSD License), see http://www.jcraft.com
|
||||||
|
JFreeChart (LGPLv3 License), see http://www.jfree.org/jfreechart/
|
||||||
|
JGoodies (BSD License), see http://www.jgoodies.com
|
||||||
|
JNA (APACHE License), see https://github.com/java-native-access/jna
|
||||||
|
jregex (BSD License), see http://jregex.sourceforge.net/
|
||||||
|
OpenCSV (APACHE License), see http://opencsv.sourceforge.net/
|
||||||
|
Otros-System (APACHE License), see https://github.com/otros-systems/otrosvfsbrowser
|
||||||
|
Pagosoft (APACHE License), see http://www.pagosoft.com/projects/pgslookandfeel/
|
||||||
|
PBS-Java (MIT License), see https://github.com/biouno/pbs-java-api
|
||||||
|
Prettytime (APACHE License), see https://github.com/ocpsoft/prettytime
|
||||||
|
RSyntaxTextArea (BSD License), see https://github.com/bobbylight/RSyntaxTextArea
|
||||||
|
SLFJ (MIT License), see http://www.slf4j.org/
|
||||||
|
VTK (BSD License), see http://www.vtk.org/
|
||||||
22
README.md
22
README.md
|
|
@ -1,7 +1,7 @@
|
||||||
# HELYX-OS
|
# 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+. 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.
|
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
|
## 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/).
|
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/).
|
||||||
|
|
@ -16,16 +16,22 @@ Visit [http://engys.github.io/HELYX-OS/](http://engys.github.io/HELYX-OS/) to do
|
||||||
|
|
||||||
### Steps to Compile
|
### Steps to Compile
|
||||||
1. Make sure the Oracle based java and JDK are installed in your machine (use `java -version` and `javac --version`) and configured correctly.
|
1. Make sure the Oracle based java and JDK are installed in your machine (use `java -version` and `javac --version`) and configured correctly.
|
||||||
2. Navigate to the HELYX-OS directory (e.g. /home/user/Engys/HELYX-OS/vX.X.X)
|
2. Clone the HELYX-OS git repository in a clean folder (e.g. /home/user/git)
|
||||||
3. Clone the HELYX-OS git repository
|
|
||||||
|
|
||||||
git clone https://github.com/ENGYS/HELYX-OS
|
git clone https://github.com/ENGYS/HELYX-OS
|
||||||
|
|
||||||
4. Compile using the command
|
3. Navigate to the HELYX-OS directory (e.g. /home/user/Engys/HELYX-OS/vX.X.X)
|
||||||
|
4. Move the sources in the HELYX-OS folder using the command
|
||||||
|
|
||||||
|
cp -R /home/user/git/HELYX-OS/* .
|
||||||
|
|
||||||
|
5. Compile using the command
|
||||||
|
|
||||||
ant -buildfile build_src.xml
|
ant -buildfile build_src.xml
|
||||||
|
|
||||||
5. Run HELYX-OS with the command `./HELYX-OS.sh`
|
6. Run HELYX-OS with the command
|
||||||
|
|
||||||
####Disclaimer
|
./HELYX-OS.sh
|
||||||
None of the OPENFOAM® related products and services offered by ENGYS are approved or endorsed by OpenCFD Ltd. (ESI Group), producer of the OpenFOAM software and owner of the OPENFOAM® and OpenCFD® trade marks.
|
|
||||||
|
## Disclaimer
|
||||||
|
This offering is not approved or endorsed by OpenCFD Limited, producer and distributor of the OpenFOAM software via www.openfoam.com, and owner of the OPENFOAM® and OpenCFD® trade marks.
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,20 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?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.name" value="HELYX-OS" />
|
||||||
<property name="component.version" value="2.3.1" />
|
<property name="component.vendor" value="Engys" />
|
||||||
<property name="component.vendor" value="" />
|
<property name="component.mail" value="info@engys.com" />
|
||||||
|
<property name="component.site" value="http://engys.github.io/HELYX-OS/" />
|
||||||
<property name="version" value="ocfd" />
|
<property name="component.copyright" value="Copyright © ENGYS Ltd 2016. All rights reserved." />
|
||||||
<property name="version.name" value="OCFD" />
|
<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="jar.name" value="${component.name}.jar" />
|
||||||
|
|
||||||
<property name="src.dir" value="src" />
|
<property name="src.dir" value="src" />
|
||||||
<property name="build.dir" value="build" />
|
<property name="build.dir" value="build" />
|
||||||
|
|
||||||
<property name="lib.dir" value="lib" />
|
<property name="lib.dir" value="lib" />
|
||||||
<property name="dist.dir" value="dist" />
|
|
||||||
|
|
||||||
<path id="main.path">
|
<path id="build.path">
|
||||||
<fileset dir="${lib.dir}">
|
<fileset dir="${lib.dir}">
|
||||||
<include name="**/*.jar" />
|
<include name="**/*.jar" />
|
||||||
</fileset>
|
</fileset>
|
||||||
|
|
@ -29,8 +27,7 @@
|
||||||
<target name="compile" depends="init">
|
<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">
|
<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="eu/engys/**/*.java" />
|
||||||
<include name="vtk/**/*.java" />
|
<classpath refid="build.path" />
|
||||||
<classpath refid="main.path" />
|
|
||||||
</javac>
|
</javac>
|
||||||
<copy todir="${build.dir}">
|
<copy todir="${build.dir}">
|
||||||
<fileset dir="${src.dir}" includes="**/resources/**/*, **/*.png, **/*.jpeg, **/*.jpg, **/*.gif, **/*.properties" />
|
<fileset dir="${src.dir}" includes="**/resources/**/*, **/*.png, **/*.jpeg, **/*.jpg, **/*.gif, **/*.properties" />
|
||||||
|
|
@ -40,13 +37,17 @@
|
||||||
<entry key="name" value="${component.name}" />
|
<entry key="name" value="${component.name}" />
|
||||||
<entry key="vendor" value="${component.vendor}" />
|
<entry key="vendor" value="${component.vendor}" />
|
||||||
<entry key="version" value="${component.version}" />
|
<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" />
|
<entry key="build" type="date" value="now" pattern="yyyy-MM-dd" />
|
||||||
|
|
||||||
</propertyfile>
|
</propertyfile>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="jar" depends="compile" description="">
|
<target name="dist" depends="compile" description="">
|
||||||
<pathconvert property="main.class.path" pathsep=" ">
|
<pathconvert property="main.class.path" pathsep=" ">
|
||||||
<path refid="main.path" />
|
<path refid="build.path" />
|
||||||
<mapper>
|
<mapper>
|
||||||
<chainedmapper>
|
<chainedmapper>
|
||||||
<flattenmapper />
|
<flattenmapper />
|
||||||
|
|
@ -54,7 +55,6 @@
|
||||||
</mapper>
|
</mapper>
|
||||||
</pathconvert>
|
</pathconvert>
|
||||||
|
|
||||||
<!-- set the date -->
|
|
||||||
<tstamp>
|
<tstamp>
|
||||||
<format property="TODAY" pattern="yyyy-MM-dd" />
|
<format property="TODAY" pattern="yyyy-MM-dd" />
|
||||||
</tstamp>
|
</tstamp>
|
||||||
|
|
@ -64,7 +64,7 @@
|
||||||
<!-- define MANIFEST.MF -->
|
<!-- define MANIFEST.MF -->
|
||||||
<manifest>
|
<manifest>
|
||||||
<attribute name="Built-By" value="${user.name}" />
|
<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-Title" value="${component.name}" />
|
||||||
<attribute name="Specification-Version" value="${component.version}" />
|
<attribute name="Specification-Version" value="${component.version}" />
|
||||||
<attribute name="Specification-Vendor" value="${component.vendor}" />
|
<attribute name="Specification-Vendor" value="${component.vendor}" />
|
||||||
|
|
@ -73,25 +73,11 @@
|
||||||
<attribute name="Implementation-Vendor" value="${component.vendor}" />
|
<attribute name="Implementation-Vendor" value="${component.vendor}" />
|
||||||
|
|
||||||
<attribute name="Class-Path" value="${main.class.path}" />
|
<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>
|
</manifest>
|
||||||
</jar>
|
</jar>
|
||||||
</target>
|
</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">
|
<target name="clean">
|
||||||
<delete dir="${build.dir}" />
|
<delete dir="${build.dir}" />
|
||||||
<delete quiet="true">
|
<delete quiet="true">
|
||||||
|
|
|
||||||
|
|
@ -1,32 +1,30 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
package eu.engys.application;
|
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.BorderLayout;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
|
|
@ -37,6 +35,7 @@ import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.WindowAdapter;
|
import java.awt.event.WindowAdapter;
|
||||||
import java.awt.event.WindowEvent;
|
import java.awt.event.WindowEvent;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.swing.AbstractAction;
|
import javax.swing.AbstractAction;
|
||||||
import javax.swing.Icon;
|
import javax.swing.Icon;
|
||||||
|
|
@ -51,19 +50,23 @@ import org.slf4j.LoggerFactory;
|
||||||
import eu.engys.core.Arguments;
|
import eu.engys.core.Arguments;
|
||||||
import eu.engys.core.OpenFOAMEnvironment;
|
import eu.engys.core.OpenFOAMEnvironment;
|
||||||
import eu.engys.core.controller.Controller;
|
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.presentation.ActionManager;
|
||||||
import eu.engys.core.project.Model;
|
import eu.engys.core.project.Model;
|
||||||
import eu.engys.gui.AboutWindow;
|
import eu.engys.gui.AboutWindow;
|
||||||
import eu.engys.gui.GlassPane;
|
import eu.engys.gui.GlassPane;
|
||||||
|
import eu.engys.gui.PreferencesBean;
|
||||||
import eu.engys.gui.PreferencesDialog;
|
import eu.engys.gui.PreferencesDialog;
|
||||||
import eu.engys.gui.events.EventManager;
|
import eu.engys.gui.events.EventManager;
|
||||||
import eu.engys.gui.view.View;
|
import eu.engys.gui.view.View;
|
||||||
import eu.engys.gui.view3D.View3DEventListener;
|
import eu.engys.gui.view3D.View3DEventListener;
|
||||||
|
import eu.engys.util.ui.ExecUtil;
|
||||||
import eu.engys.util.ui.ResourcesUtil;
|
import eu.engys.util.ui.ResourcesUtil;
|
||||||
import eu.engys.util.ui.UiUtil;
|
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);
|
||||||
|
|
||||||
|
|
@ -73,8 +76,11 @@ public abstract class AbstractApplication implements Application, ActionContaine
|
||||||
public Controller controller;
|
public Controller controller;
|
||||||
protected View3DEventListener view3dListener;
|
protected View3DEventListener view3dListener;
|
||||||
|
|
||||||
public AbstractApplication(Model model, View view, Controller controller) {
|
protected Set<ApplicationModule> modules;
|
||||||
|
|
||||||
|
public AbstractApplication(Model model, Set<ApplicationModule> modules, View view, Controller controller) {
|
||||||
this.model = model;
|
this.model = model;
|
||||||
|
this.modules = modules;
|
||||||
this.view = view;
|
this.view = view;
|
||||||
this.controller = controller;
|
this.controller = controller;
|
||||||
}
|
}
|
||||||
|
|
@ -84,36 +90,33 @@ public abstract class AbstractApplication implements Application, ActionContaine
|
||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isDemo() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void checkVersion() {
|
public void checkVersion() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void start(final Arguments arguments) {
|
||||||
|
ExecUtil.invokeLater(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
initFrame();
|
initFrame();
|
||||||
frame.setVisible(true);
|
frame.setVisible(true);
|
||||||
trySettingOpenFoamFolder();
|
trySettingOpenFoamFolder();
|
||||||
|
|
||||||
if (Arguments.stlFiles != null) {
|
executeStartupActions(arguments);
|
||||||
if (Arguments.baseDir != null) {
|
|
||||||
ActionManager.getInstance().invoke("application.open");
|
closeSplash();
|
||||||
} else {
|
|
||||||
ActionManager.getInstance().invoke("application.create");
|
|
||||||
}
|
}
|
||||||
} else {
|
});
|
||||||
if (Arguments.baseDir != null) {
|
}
|
||||||
controller.openCase(Arguments.baseDir);
|
|
||||||
|
protected void executeStartupActions(Arguments arguments) {
|
||||||
|
if (arguments.baseDir != null) {
|
||||||
|
controller.openCase(OpenOptions.file(arguments.baseDir, OpenMode.CHECK_FOLDER_ASK_USER));
|
||||||
} else {
|
} else {
|
||||||
view.showStartupDialog(this);
|
view.showStartupDialog(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
close();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void trySettingOpenFoamFolder() {
|
protected void trySettingOpenFoamFolder() {
|
||||||
OpenFOAMEnvironment.trySettingOpenFoamFolder(frame);
|
OpenFOAMEnvironment.trySettingOpenFoamFolder(frame);
|
||||||
|
|
@ -130,14 +133,13 @@ public abstract class AbstractApplication implements Application, ActionContaine
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method fixes the Synthetica laf bug that causes incorrect
|
* This method fixes the Synthetica laf bug that causes incorrect fullscreen window size on secondary monitor.
|
||||||
* fullscreen window size on secondary monitor.
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void setMaximizedBounds(Rectangle bounds) {
|
public void setMaximizedBounds(Rectangle bounds) {
|
||||||
GraphicsDevice currentFrame = getGraphicsConfiguration().getDevice();
|
GraphicsDevice currentFrame = getGraphicsConfiguration().getDevice();
|
||||||
if (UiUtil.isSecondaryScreen(currentFrame) && getExtendedState() == JFrame.NORMAL) {
|
if (UiUtil.isSecondaryScreen(currentFrame) && getExtendedState() == JFrame.NORMAL) {
|
||||||
super.setMaximizedBounds(UiUtil.getCurrentScreenSize(frame));
|
super.setMaximizedBounds(UiUtil.getCurrentScreenSize(this));
|
||||||
} else {
|
} else {
|
||||||
super.setMaximizedBounds(bounds);
|
super.setMaximizedBounds(bounds);
|
||||||
}
|
}
|
||||||
|
|
@ -159,7 +161,7 @@ public abstract class AbstractApplication implements Application, ActionContaine
|
||||||
frame.addWindowListener(new WindowAdapter() {
|
frame.addWindowListener(new WindowAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void windowClosing(WindowEvent e) {
|
public void windowClosing(WindowEvent e) {
|
||||||
ActionManager.getInstance().invoke("application.exit");
|
ActionManager.getInstance().invoke(View.EXIT);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
frame.setName("MainFrame");
|
frame.setName("MainFrame");
|
||||||
|
|
@ -174,7 +176,6 @@ public abstract class AbstractApplication implements Application, ActionContaine
|
||||||
frame.setGlassPane(glassPane);
|
frame.setGlassPane(glassPane);
|
||||||
glassPane.setVisible(false);
|
glassPane.setVisible(false);
|
||||||
|
|
||||||
|
|
||||||
customizeGUIFrame(view);
|
customizeGUIFrame(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -191,29 +192,21 @@ public abstract class AbstractApplication implements Application, ActionContaine
|
||||||
protected abstract void customizeGUIFrame(View view);
|
protected abstract void customizeGUIFrame(View view);
|
||||||
|
|
||||||
protected void addPreferencesItem(final View view) {
|
protected void addPreferencesItem(final View view) {
|
||||||
JMenuItem preferencesItem = new JMenuItem(new AbstractAction("Preferences", PREFERENCES_ICON) {
|
JMenuItem preferencesItem = new JMenuItem(new AbstractAction(PREFERENCES_LABEL, PREFERENCES_ICON) {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
new PreferencesDialog(isOS(), hasParaview(), hasFieldView(), hasEnsight(), hasSolverPreferences(), model.getDefaults().getDictDataFolder()).show();
|
if (controller.isDemo()) {
|
||||||
|
UiUtil.showDemoMessage();
|
||||||
|
} else {
|
||||||
|
new PreferencesDialog(getPreferencesBean(), model.getDefaults().getDictDataFolder()).show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
preferencesItem.setName("Application Preferences");
|
preferencesItem.setName("Application Preferences");
|
||||||
view.getMenuBar().getEditMenu().add(preferencesItem);
|
view.getMenuBar().getEditMenu().add(preferencesItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract boolean hasParaview();
|
protected abstract PreferencesBean getPreferencesBean();
|
||||||
|
|
||||||
protected abstract boolean hasFieldView();
|
|
||||||
|
|
||||||
protected abstract boolean hasEnsight();
|
|
||||||
|
|
||||||
protected boolean hasSolverPreferences() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected boolean isOS() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void addHelpItem(final View view) {
|
protected void addHelpItem(final View view) {
|
||||||
view.getMenuBar().getHelpMenu().add(new AbstractAction("About", INFO_ICON) {
|
view.getMenuBar().getHelpMenu().add(new AbstractAction("About", INFO_ICON) {
|
||||||
|
|
@ -224,7 +217,6 @@ public abstract class AbstractApplication implements Application, ActionContaine
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JPanel createAdPanel() {
|
public JPanel createAdPanel() {
|
||||||
return new JPanel();
|
return new JPanel();
|
||||||
|
|
@ -235,14 +227,24 @@ public abstract class AbstractApplication implements Application, ActionContaine
|
||||||
return new JPanel();
|
return new JPanel();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* RESOURCES
|
* RESOURCES
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
public static final String PREFERENCES_LABEL = "Preferences";
|
||||||
public static final Icon PREFERENCES_ICON = ResourcesUtil.getIcon("preferences.icon");
|
public static final Icon PREFERENCES_ICON = ResourcesUtil.getIcon("preferences.icon");
|
||||||
public static final Icon LICENSE_ICON = ResourcesUtil.getIcon("license.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 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");
|
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 SMALL_LOGO = ResourcesUtil.getIcon("engys.logo");
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,27 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
package eu.engys.application;
|
package eu.engys.application;
|
||||||
|
|
||||||
import java.awt.BorderLayout;
|
import java.awt.BorderLayout;
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,27 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
package eu.engys.application;
|
package eu.engys.application;
|
||||||
|
|
||||||
|
|
@ -30,7 +29,11 @@ import javax.swing.Icon;
|
||||||
import javax.swing.JFrame;
|
import javax.swing.JFrame;
|
||||||
import javax.swing.JPanel;
|
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 JFrame getFrame();
|
||||||
public void initFrame();
|
public void initFrame();
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,27 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
package eu.engys.application;
|
package eu.engys.application;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,35 +1,37 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
package eu.engys.application;
|
package eu.engys.application;
|
||||||
|
|
||||||
|
import eu.engys.core.Arguments;
|
||||||
|
|
||||||
public interface Batch extends Runnable {
|
public interface Batch {
|
||||||
|
|
||||||
public abstract String getTitle();
|
public abstract String getTitle();
|
||||||
|
|
||||||
}
|
public abstract void start(Arguments arguments);
|
||||||
|
|
||||||
|
public abstract void checkLicense();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,27 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
package eu.engys.application;
|
package eu.engys.application;
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
|
|
@ -31,6 +30,7 @@ import java.awt.Font;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.swing.AbstractAction;
|
import javax.swing.AbstractAction;
|
||||||
import javax.swing.BorderFactory;
|
import javax.swing.BorderFactory;
|
||||||
|
|
@ -46,16 +46,17 @@ import com.google.inject.Inject;
|
||||||
|
|
||||||
import eu.engys.core.OpenFOAMEnvironment;
|
import eu.engys.core.OpenFOAMEnvironment;
|
||||||
import eu.engys.core.controller.Controller;
|
import eu.engys.core.controller.Controller;
|
||||||
import eu.engys.core.presentation.Action;
|
import eu.engys.core.modules.ApplicationModule;
|
||||||
import eu.engys.core.presentation.ActionManager;
|
|
||||||
import eu.engys.core.project.Model;
|
import eu.engys.core.project.Model;
|
||||||
import eu.engys.core.project.zero.patches.BoundaryType;
|
import eu.engys.core.project.zero.patches.BoundaryType;
|
||||||
|
import eu.engys.gui.PreferencesBean;
|
||||||
import eu.engys.gui.view.View;
|
import eu.engys.gui.view.View;
|
||||||
import eu.engys.util.ApplicationInfo;
|
import eu.engys.util.ApplicationInfo;
|
||||||
import eu.engys.util.Symbols;
|
import eu.engys.util.Symbols;
|
||||||
import eu.engys.util.Util;
|
import eu.engys.util.Util;
|
||||||
import eu.engys.util.VersionChecker;
|
import eu.engys.util.VersionChecker;
|
||||||
import eu.engys.util.VersionChecker.VersionType;
|
import eu.engys.util.VersionChecker.VersionType;
|
||||||
|
import eu.engys.util.ui.ExecUtil;
|
||||||
import eu.engys.util.ui.ResourcesUtil;
|
import eu.engys.util.ui.ResourcesUtil;
|
||||||
|
|
||||||
public class HELYXOS extends AbstractApplication {
|
public class HELYXOS extends AbstractApplication {
|
||||||
|
|
@ -67,9 +68,8 @@ public class HELYXOS extends AbstractApplication {
|
||||||
private JButton versionButton;
|
private JButton versionButton;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public HELYXOS(Model model, View view, Controller controller) {
|
public HELYXOS(Model model, Set<ApplicationModule> modules, View view, Controller controller) {
|
||||||
super(model, view, controller);
|
super(model, modules, view, controller);
|
||||||
ActionManager.getInstance().parseActions(this);
|
|
||||||
|
|
||||||
BoundaryType.registerBoundaryType(BoundaryType.PATCH);
|
BoundaryType.registerBoundaryType(BoundaryType.PATCH);
|
||||||
BoundaryType.registerBoundaryType(BoundaryType.WALL);
|
BoundaryType.registerBoundaryType(BoundaryType.WALL);
|
||||||
|
|
@ -107,7 +107,6 @@ public class HELYXOS extends AbstractApplication {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Action(key = "application.support.window")
|
|
||||||
public void showSupportWindow() {
|
public void showSupportWindow() {
|
||||||
new SupportWindow(getMediumIcon(), getBannerIcon(), DISCLAIMER);
|
new SupportWindow(getMediumIcon(), getBannerIcon(), DISCLAIMER);
|
||||||
}
|
}
|
||||||
|
|
@ -117,7 +116,9 @@ public class HELYXOS extends AbstractApplication {
|
||||||
new Thread(new Runnable() {
|
new Thread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
VersionType versionType = VersionChecker.isNewVersionAvailable();
|
final VersionType versionType = VersionChecker.isNewVersionAvailable();
|
||||||
|
ExecUtil.invokeLater(new Runnable() {
|
||||||
|
public void run() {
|
||||||
if (versionType.isUpdated()) {
|
if (versionType.isUpdated()) {
|
||||||
versionLabel.setText("Your version is up to date!");
|
versionLabel.setText("Your version is up to date!");
|
||||||
versionLabel.setForeground(Color.GREEN.darker());
|
versionLabel.setForeground(Color.GREEN.darker());
|
||||||
|
|
@ -131,6 +132,8 @@ public class HELYXOS extends AbstractApplication {
|
||||||
versionButton.setVisible(false);
|
versionButton.setVisible(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}).start();
|
}).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -162,23 +165,18 @@ public class HELYXOS extends AbstractApplication {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isOS() {
|
protected PreferencesBean getPreferencesBean() {
|
||||||
return true;
|
PreferencesBean bean = new PreferencesBean();
|
||||||
}
|
bean.setPathPreferences(true);
|
||||||
|
bean.setBatchPreferences(false);
|
||||||
@Override
|
bean.setVtkPreferences(true);
|
||||||
protected boolean hasParaview() {
|
bean.setMiscPreferences(true);
|
||||||
return true;
|
bean.setParaview(true);
|
||||||
}
|
bean.setParaviewBatch(false);
|
||||||
|
bean.setEnsight(false);
|
||||||
@Override
|
bean.setFieldview(false);
|
||||||
protected boolean hasFieldView() {
|
bean.setOS(true);
|
||||||
return false;
|
return bean;
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean hasEnsight() {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,27 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
package eu.engys.application;
|
package eu.engys.application;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,27 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
package eu.engys.application.modules;
|
package eu.engys.application.modules;
|
||||||
|
|
||||||
import com.google.inject.AbstractModule;
|
import com.google.inject.AbstractModule;
|
||||||
|
|
@ -32,7 +31,6 @@ import com.google.inject.name.Names;
|
||||||
|
|
||||||
import eu.engys.application.Application;
|
import eu.engys.application.Application;
|
||||||
import eu.engys.application.HELYXOS;
|
import eu.engys.application.HELYXOS;
|
||||||
import eu.engys.core.Arguments;
|
|
||||||
import eu.engys.core.controller.Controller;
|
import eu.engys.core.controller.Controller;
|
||||||
import eu.engys.core.controller.HelyxOSController;
|
import eu.engys.core.controller.HelyxOSController;
|
||||||
import eu.engys.core.controller.ScriptFactory;
|
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.CaseSetup3DElement;
|
||||||
import eu.engys.gui.casesetup.CaseSetupElement;
|
import eu.engys.gui.casesetup.CaseSetupElement;
|
||||||
import eu.engys.gui.casesetup.RuntimeControlsPanel;
|
import eu.engys.gui.casesetup.RuntimeControlsPanel;
|
||||||
|
import eu.engys.gui.casesetup.StandardSolverSettingsPanel;
|
||||||
import eu.engys.gui.casesetup.actions.StandardCaseSetupActions;
|
import eu.engys.gui.casesetup.actions.StandardCaseSetupActions;
|
||||||
import eu.engys.gui.casesetup.boundaryconditions.BoundaryConditionsPanel;
|
import eu.engys.gui.casesetup.boundaryconditions.panels.BoundaryConditionsPanel;
|
||||||
import eu.engys.gui.casesetup.boundaryconditions.panels.CyclicSettingsPanel;
|
|
||||||
import eu.engys.gui.casesetup.boundaryconditions.panels.StandardCyclicAMISettingsPanel;
|
import eu.engys.gui.casesetup.boundaryconditions.panels.StandardCyclicAMISettingsPanel;
|
||||||
import eu.engys.gui.casesetup.boundaryconditions.panels.patch.PatchSettingsPanel;
|
import eu.engys.gui.casesetup.boundaryconditions.panels.patch.PatchSettingsPanel;
|
||||||
import eu.engys.gui.casesetup.boundaryconditions.panels.wall.StandardWallSettingsPanel;
|
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.CellZonesPanel;
|
||||||
import eu.engys.gui.casesetup.cellzones.StandardCellZonesBuilder;
|
import eu.engys.gui.casesetup.cellzones.StandardCellZonesBuilder;
|
||||||
import eu.engys.gui.casesetup.cellzones.mrf.StandardMRF;
|
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.run.StandardTable15;
|
||||||
import eu.engys.gui.casesetup.schemes.NumericalSchemesPanel;
|
import eu.engys.gui.casesetup.schemes.NumericalSchemesPanel;
|
||||||
import eu.engys.gui.casesetup.solution.StandardSolutionModellingPanel;
|
import eu.engys.gui.casesetup.solution.StandardSolutionModellingPanel;
|
||||||
import eu.engys.gui.casesetup.solver.SolverSettingsPanel;
|
|
||||||
import eu.engys.gui.custom.CustomNodePanel;
|
import eu.engys.gui.custom.CustomNodePanel;
|
||||||
import eu.engys.gui.mesh.Mesh;
|
import eu.engys.gui.mesh.Mesh;
|
||||||
import eu.engys.gui.mesh.Mesh3DElement;
|
import eu.engys.gui.mesh.Mesh3DElement;
|
||||||
import eu.engys.gui.mesh.MeshElement;
|
import eu.engys.gui.mesh.MeshElement;
|
||||||
|
import eu.engys.gui.mesh.StandardBoundaryMeshPanel;
|
||||||
import eu.engys.gui.mesh.actions.StandardMeshActions;
|
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.DefaultMeshAdvancedOptionsPanel;
|
||||||
import eu.engys.gui.mesh.panels.MaterialPointsPanel;
|
import eu.engys.gui.mesh.panels.MaterialPointsPanel;
|
||||||
import eu.engys.gui.mesh.panels.SolverBoundaryMeshPanel;
|
import eu.engys.gui.mesh.panels.SolverBoundaryMeshPanel;
|
||||||
|
|
@ -113,26 +111,19 @@ import eu.engys.gui.solver.postprocessing.panels.residuals.ResidualsPanel;
|
||||||
import eu.engys.gui.view.View;
|
import eu.engys.gui.view.View;
|
||||||
import eu.engys.gui.view.View3DElement;
|
import eu.engys.gui.view.View3DElement;
|
||||||
import eu.engys.gui.view.ViewElement;
|
import eu.engys.gui.view.ViewElement;
|
||||||
import eu.engys.gui.view3D.CanvasPanel;
|
|
||||||
import eu.engys.gui.view3D.Controller3D;
|
import eu.engys.gui.view3D.Controller3D;
|
||||||
import eu.engys.gui.view3D.Geometry3DController;
|
import eu.engys.gui.view3D.Geometry3DController;
|
||||||
import eu.engys.gui.view3D.Mesh3DController;
|
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.gui.view3D.widget.Widget;
|
||||||
import eu.engys.launcher.ApplicationLauncher;
|
import eu.engys.launcher.ApplicationLauncher;
|
||||||
import eu.engys.launcher.HELYXOSLauncher;
|
import eu.engys.launcher.HELYXOSLauncher;
|
||||||
|
import eu.engys.standardDynamic.StandardDynamicModule;
|
||||||
import eu.engys.standardVOF.StandardVOFModule;
|
import eu.engys.standardVOF.StandardVOFModule;
|
||||||
import eu.engys.util.VTKSettings;
|
import eu.engys.combustion.CombustionModule;
|
||||||
import eu.engys.util.plaf.HelyxOSLookAndFeel;
|
import eu.engys.util.plaf.HelyxOSLookAndFeel;
|
||||||
import eu.engys.util.plaf.ILookAndFeel;
|
import eu.engys.util.plaf.ILookAndFeel;
|
||||||
import eu.engys.util.progress.ProgressMonitor;
|
import eu.engys.util.progress.ProgressMonitor;
|
||||||
import eu.engys.util.progress.ProgressMonitorImpl;
|
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;
|
import eu.engys.vtk.WidgetPanel;
|
||||||
|
|
||||||
public class HELYXOSModule extends AbstractModule {
|
public class HELYXOSModule extends AbstractModule {
|
||||||
|
|
@ -184,27 +175,12 @@ public class HELYXOSModule extends AbstractModule {
|
||||||
private void configureModules() {
|
private void configureModules() {
|
||||||
Multibinder<ApplicationModule> applicationModules = Multibinder.newSetBinder(binder(), ApplicationModule.class);
|
Multibinder<ApplicationModule> applicationModules = Multibinder.newSetBinder(binder(), ApplicationModule.class);
|
||||||
applicationModules.addBinding().to(StandardVOFModule.class).in(Singleton.class);
|
applicationModules.addBinding().to(StandardVOFModule.class).in(Singleton.class);
|
||||||
|
applicationModules.addBinding().to(StandardDynamicModule.class).in(Singleton.class);
|
||||||
|
applicationModules.addBinding().to(CombustionModule.class).in(Singleton.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void configure3D() {
|
protected void configure3D() {
|
||||||
bind(WidgetPanel.class).in(Singleton.class);
|
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);
|
Multibinder<Controller3D> controllers = Multibinder.newSetBinder(binder(), Controller3D.class);
|
||||||
controllers.addBinding().to(Geometry3DController.class).in(Singleton.class);
|
controllers.addBinding().to(Geometry3DController.class).in(Singleton.class);
|
||||||
controllers.addBinding().to(Mesh3DController.class).in(Singleton.class);
|
controllers.addBinding().to(Mesh3DController.class).in(Singleton.class);
|
||||||
|
|
@ -242,7 +218,7 @@ public class HELYXOSModule extends AbstractModule {
|
||||||
panelsMesh.addBinding().to(StandardGeometryPanel.class).in(Singleton.class);
|
panelsMesh.addBinding().to(StandardGeometryPanel.class).in(Singleton.class);
|
||||||
panelsMesh.addBinding().to(StandardFeatureLinesPanel.class).in(Singleton.class);
|
panelsMesh.addBinding().to(StandardFeatureLinesPanel.class).in(Singleton.class);
|
||||||
panelsMesh.addBinding().to(MaterialPointsPanel.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);
|
panelsMesh.addBinding().to(CustomNodePanel.class).in(Singleton.class);
|
||||||
|
|
||||||
Multibinder<GUIPanel> panelsCaseSetup = Multibinder.newSetBinder(binder(), GUIPanel.class, CaseSetup.class);
|
Multibinder<GUIPanel> panelsCaseSetup = Multibinder.newSetBinder(binder(), GUIPanel.class, CaseSetup.class);
|
||||||
|
|
@ -250,8 +226,9 @@ public class HELYXOSModule extends AbstractModule {
|
||||||
panelsCaseSetup.addBinding().to(MaterialsPanel.class).in(Singleton.class);
|
panelsCaseSetup.addBinding().to(MaterialsPanel.class).in(Singleton.class);
|
||||||
panelsCaseSetup.addBinding().to(BoundaryConditionsPanel.class).in(Singleton.class);
|
panelsCaseSetup.addBinding().to(BoundaryConditionsPanel.class).in(Singleton.class);
|
||||||
panelsCaseSetup.addBinding().to(CellZonesPanel.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(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(RuntimeControlsPanel.class).in(Singleton.class);
|
||||||
panelsCaseSetup.addBinding().to(StandardFieldsInitialisationPanel.class).in(Singleton.class);
|
panelsCaseSetup.addBinding().to(StandardFieldsInitialisationPanel.class).in(Singleton.class);
|
||||||
panelsCaseSetup.addBinding().to(CustomNodePanel.class).in(Singleton.class);
|
panelsCaseSetup.addBinding().to(CustomNodePanel.class).in(Singleton.class);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,81 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* | 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.combustion;
|
||||||
|
|
||||||
|
import eu.engys.core.modules.boundaryconditions.BoundaryConditionsView;
|
||||||
|
import eu.engys.core.modules.boundaryconditions.BoundaryTypePanel;
|
||||||
|
import eu.engys.core.modules.boundaryconditions.IBoundaryConditionsPanel;
|
||||||
|
import eu.engys.core.project.Model;
|
||||||
|
import eu.engys.core.project.zero.patches.BoundaryType;
|
||||||
|
import eu.engys.gui.casesetup.boundaryconditions.panels.patch.MomentumPatch;
|
||||||
|
import eu.engys.gui.casesetup.boundaryconditions.panels.wall.StandardMomentumWall;
|
||||||
|
import eu.engys.gui.casesetup.boundaryconditions.parameterspanel.MomentumParametersPanel;
|
||||||
|
|
||||||
|
public class CombustionBoundaryConditionsView implements BoundaryConditionsView {
|
||||||
|
|
||||||
|
public static final String MOMENTUM = " " + MomentumParametersPanel.MOMENTUM + " ";
|
||||||
|
private CombustionModule module;
|
||||||
|
|
||||||
|
public CombustionBoundaryConditionsView(CombustionModule module) {
|
||||||
|
this.module = module;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void configure(BoundaryTypePanel panel) {
|
||||||
|
if (panel.getType() == BoundaryType.WALL) {
|
||||||
|
panel.addPanel(MOMENTUM, new VOFStandardMomentumWall(panel), 0);
|
||||||
|
} else if (panel.getType() == BoundaryType.PATCH) {
|
||||||
|
panel.addPanel(MOMENTUM, new VOFStandardMomentumPatch(panel), 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class VOFStandardMomentumWall extends StandardMomentumWall {
|
||||||
|
public VOFStandardMomentumWall(BoundaryTypePanel parent) {
|
||||||
|
super(parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEnabled(Model model) {
|
||||||
|
return module.isReacting();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class VOFStandardMomentumPatch extends MomentumPatch {
|
||||||
|
|
||||||
|
public VOFStandardMomentumPatch(BoundaryTypePanel parent) {
|
||||||
|
super(parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEnabled(Model model) {
|
||||||
|
return module.isReacting();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void configure(IBoundaryConditionsPanel panel) {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
196
src/eu/engys/combustion/CombustionModule.java
Normal file
196
src/eu/engys/combustion/CombustionModule.java
Normal file
|
|
@ -0,0 +1,196 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* | 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.combustion;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import eu.engys.core.dictionary.Dictionary;
|
||||||
|
import eu.engys.core.dictionary.FieldElement;
|
||||||
|
import eu.engys.core.modules.ApplicationModuleAdapter;
|
||||||
|
import eu.engys.core.modules.ModuleDefaults;
|
||||||
|
import eu.engys.core.modules.ModulePanel;
|
||||||
|
import eu.engys.core.modules.boundaryconditions.BoundaryConditionsView;
|
||||||
|
import eu.engys.core.modules.solutionmodelling.SolutionView;
|
||||||
|
import eu.engys.core.modules.tree.TreeView;
|
||||||
|
import eu.engys.core.project.Model;
|
||||||
|
import eu.engys.core.project.defaults.DefaultsProvider;
|
||||||
|
import eu.engys.core.project.state.Solver;
|
||||||
|
import eu.engys.core.project.state.State;
|
||||||
|
import eu.engys.core.project.state.StateBuilder;
|
||||||
|
import eu.engys.core.project.zero.fields.Fields;
|
||||||
|
import eu.engys.core.project.zero.fields.FieldsDefaults;
|
||||||
|
import eu.engys.gui.casesetup.phases.PhasesPanel;
|
||||||
|
import eu.engys.gui.casesetup.reactions.ReactionsPanel;
|
||||||
|
|
||||||
|
public class CombustionModule extends ApplicationModuleAdapter {
|
||||||
|
|
||||||
|
private static final String MODULE_NAME = "combustion";
|
||||||
|
|
||||||
|
public static final Solver REACTINGFOAM_FOAM = new Solver("reactingFoam");
|
||||||
|
|
||||||
|
public static final String VOF_LABEL = "VOF";
|
||||||
|
public static final String VOF_KEY = "VOF";
|
||||||
|
|
||||||
|
private CombustionSolutionView solutionView;
|
||||||
|
private CombustionBoundaryConditionsView boundaryConditionsView;
|
||||||
|
|
||||||
|
private ReactionsPanel reactionsPanel;
|
||||||
|
private TreeView treeView;
|
||||||
|
|
||||||
|
private double sigma;
|
||||||
|
|
||||||
|
private Model model;
|
||||||
|
private DefaultsProvider defaults;
|
||||||
|
|
||||||
|
private CombustionReader reader;
|
||||||
|
|
||||||
|
private boolean reacting;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public CombustionModule(Model model) {
|
||||||
|
this.model = model;
|
||||||
|
this.solutionView = new CombustionSolutionView(this);
|
||||||
|
this.boundaryConditionsView = new CombustionBoundaryConditionsView(this);
|
||||||
|
|
||||||
|
this.reactionsPanel = new ReactionsPanel(model, new CombustionReactionsView(this, model));
|
||||||
|
this.treeView = new CombustionTreeView(this, reactionsPanel);
|
||||||
|
|
||||||
|
this.reader = new CombustionReader(model, this);
|
||||||
|
|
||||||
|
this.reacting = false;
|
||||||
|
|
||||||
|
this.defaults = new ModuleDefaults(this, model.getDefaults(), model.getDefaults().getDefaultStateData()) {
|
||||||
|
@Override
|
||||||
|
public Dictionary getDefaultsFieldMapsFor(State state, String region) {
|
||||||
|
Dictionary fieldMaps = super.getDefaultsFieldMapsFor(state, region);
|
||||||
|
fixAlphaFieldName(fieldMaps);
|
||||||
|
return fieldMaps;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private void fixAlphaFieldName(Dictionary fieldMaps) {
|
||||||
|
if (model.getState().getMultiphaseModel().isMultiphase() && model.getState().getPhases() > 1 && fieldMaps != null && fieldMaps.found(Fields.ALPHA)) {
|
||||||
|
String alpha = ((FieldElement) fieldMaps.remove(Fields.ALPHA)).getValue();
|
||||||
|
fieldMaps.add(Fields.ALPHA + "." + model.getMaterials().getFirstMaterialName(), alpha);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return MODULE_NAME;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TreeView getTreeView() {
|
||||||
|
return treeView;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Set<ModulePanel> getCaseSetupPanels() {
|
||||||
|
Set<ModulePanel> panels = new HashSet<>();
|
||||||
|
return panels;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateSolver(State state) {
|
||||||
|
if (state.isCompressible()) {
|
||||||
|
if (state.isTransient()) {
|
||||||
|
state.setSolver(REACTINGFOAM_FOAM);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void loadState() {
|
||||||
|
reader.loadState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void loadMaterials() {
|
||||||
|
reader.loadMaterials();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void save() {
|
||||||
|
new CombustionWriter(model, this).write();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void saveDefaultsToProject() {
|
||||||
|
if (isReacting()) {
|
||||||
|
StateBuilder.saveDefaultsToProject(model, defaults);
|
||||||
|
} else {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Fields loadDefaultsFields(String region) {
|
||||||
|
if (isReacting()) {
|
||||||
|
return FieldsDefaults.loadFieldsFromDefaults(model.getProject().getBaseDir(), model.getState(), defaults, model.getPatches(), region);
|
||||||
|
} else {
|
||||||
|
return new Fields();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SolutionView getSolutionView() {
|
||||||
|
return solutionView;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BoundaryConditionsView getBoundaryConditionsView() {
|
||||||
|
return boundaryConditionsView;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReacting(boolean reacting) {
|
||||||
|
this.reacting = reacting;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isReacting() {
|
||||||
|
return reacting;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSigma(double sigma) {
|
||||||
|
this.sigma = sigma;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getSigma() {
|
||||||
|
return sigma;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* For test purposes only
|
||||||
|
*/
|
||||||
|
public PhasesPanel getPhasesPanel() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
96
src/eu/engys/combustion/CombustionReactionsView.java
Normal file
96
src/eu/engys/combustion/CombustionReactionsView.java
Normal file
|
|
@ -0,0 +1,96 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* | 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.combustion;
|
||||||
|
|
||||||
|
import static eu.engys.core.project.constant.TransportProperties.SIGMA_KEY;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import eu.engys.core.dictionary.Dictionary;
|
||||||
|
import eu.engys.core.dictionary.DimensionedScalar;
|
||||||
|
import eu.engys.core.dictionary.model.DictionaryModel;
|
||||||
|
import eu.engys.core.project.Model;
|
||||||
|
import eu.engys.gui.casesetup.phases.PhasesView;
|
||||||
|
import eu.engys.gui.casesetup.reactions.ReactionsView;
|
||||||
|
import eu.engys.util.DimensionalUnits;
|
||||||
|
import eu.engys.util.ui.builder.PanelBuilder;
|
||||||
|
|
||||||
|
public class CombustionReactionsView implements ReactionsView {
|
||||||
|
|
||||||
|
public static final String SURFACE_TENSION_LABEL = "Surface Tension [N/m]";
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(CombustionReactionsView.class);
|
||||||
|
|
||||||
|
private Model model;
|
||||||
|
private CombustionModule module;
|
||||||
|
private DictionaryModel sigmaModel = new DictionaryModel(new Dictionary(""));
|
||||||
|
|
||||||
|
private PanelBuilder parametersBuilder;
|
||||||
|
|
||||||
|
public CombustionReactionsView(CombustionModule module, Model model) {
|
||||||
|
this.module = module;
|
||||||
|
this.model = model;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void layoutComponents(PanelBuilder parametersBuilder) {
|
||||||
|
this.parametersBuilder = parametersBuilder;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void load(Model model) {
|
||||||
|
if (module.isReacting()) {
|
||||||
|
_layoutComponents();
|
||||||
|
_load(model);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void _layoutComponents() {
|
||||||
|
parametersBuilder.clear();
|
||||||
|
parametersBuilder.addComponent(SURFACE_TENSION_LABEL, sigmaModel.bindDimensionedDouble(SIGMA_KEY, DimensionalUnits.KG_S2, 0D, Double.MAX_VALUE));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void _load(Model model) {
|
||||||
|
Dictionary dict = new Dictionary("");
|
||||||
|
dict.add(new DimensionedScalar(SIGMA_KEY, String.valueOf(module.getSigma()), DimensionalUnits.KG_S2));
|
||||||
|
sigmaModel.setDictionary(dict);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void save(Model model) {
|
||||||
|
if (module.isReacting()) {
|
||||||
|
_save(model);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void _save(Model model) {
|
||||||
|
Dictionary sigmaDict = sigmaModel.getDictionary();
|
||||||
|
if (sigmaDict.found(SIGMA_KEY)) {
|
||||||
|
module.setSigma(sigmaDict.lookupScalar(SIGMA_KEY).doubleValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
137
src/eu/engys/combustion/CombustionReader.java
Normal file
137
src/eu/engys/combustion/CombustionReader.java
Normal file
|
|
@ -0,0 +1,137 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* | 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.combustion;
|
||||||
|
|
||||||
|
import static eu.engys.core.project.constant.ThermophysicalProperties.MATERIAL_NAME_KEY;
|
||||||
|
import static eu.engys.core.project.constant.TransportProperties.PHASES_KEY;
|
||||||
|
import static eu.engys.core.project.constant.TransportProperties.SIGMA_KEY;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import eu.engys.core.dictionary.Dictionary;
|
||||||
|
import eu.engys.core.project.Model;
|
||||||
|
import eu.engys.core.project.constant.ConstantFolder;
|
||||||
|
import eu.engys.core.project.constant.TransportProperties;
|
||||||
|
import eu.engys.core.project.materials.Material;
|
||||||
|
import eu.engys.core.project.materials.Materials;
|
||||||
|
import eu.engys.gui.casesetup.materials.StandardMaterialsReader;
|
||||||
|
|
||||||
|
public class CombustionReader {
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(CombustionReader.class);
|
||||||
|
|
||||||
|
private Model model;
|
||||||
|
private CombustionModule module;
|
||||||
|
|
||||||
|
private TransportProperties transportProperties;
|
||||||
|
|
||||||
|
public CombustionReader(Model model, CombustionModule module) {
|
||||||
|
this.model = model;
|
||||||
|
this.module = module;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void loadState() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void loadMaterials() {
|
||||||
|
if (isMultiphaseVOF()) {
|
||||||
|
if (model.getState().isIncompressible()) {
|
||||||
|
readIncompressibleMaterials();
|
||||||
|
} else {
|
||||||
|
readCompressibleMaterials();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isMultiphaseVOF() {
|
||||||
|
ConstantFolder constantFolder = model.getProject().getConstantFolder();
|
||||||
|
TransportProperties transportProperties = constantFolder.getTransportProperties();
|
||||||
|
if (transportProperties != null) {
|
||||||
|
if ((transportProperties.found(PHASES_KEY))) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void readIncompressibleMaterials() {
|
||||||
|
Materials materials = model.getMaterials();
|
||||||
|
ConstantFolder constantFolder = model.getProject().getConstantFolder();
|
||||||
|
transportProperties = constantFolder.getTransportProperties();
|
||||||
|
|
||||||
|
if (transportProperties.found(PHASES_KEY)) {
|
||||||
|
model.getState().setPhases(2);
|
||||||
|
|
||||||
|
String phases = transportProperties.lookup(PHASES_KEY).replaceAll("\\(", "").replaceAll("\\)", "").trim();
|
||||||
|
|
||||||
|
Dictionary dict1 = new Dictionary(transportProperties.subDict(phases.split(" ")[0]));
|
||||||
|
if (!dict1.isEmpty()) {
|
||||||
|
if (!dict1.found(MATERIAL_NAME_KEY)) {
|
||||||
|
dict1.add(MATERIAL_NAME_KEY, "material1");
|
||||||
|
}
|
||||||
|
String name1 = dict1.lookup(MATERIAL_NAME_KEY);
|
||||||
|
dict1.setName(name1);
|
||||||
|
Material m1 = new StandardMaterialsReader().readIncompressibleMaterial(dict1);
|
||||||
|
materials.add(m1);
|
||||||
|
}
|
||||||
|
|
||||||
|
Dictionary dict2 = new Dictionary(transportProperties.subDict(phases.split(" ")[1]));
|
||||||
|
if (!dict2.isEmpty()) {
|
||||||
|
if (!dict2.found(MATERIAL_NAME_KEY)) {
|
||||||
|
dict2.add(MATERIAL_NAME_KEY, "material2");
|
||||||
|
}
|
||||||
|
String name2 = dict2.lookup(MATERIAL_NAME_KEY);
|
||||||
|
dict2.setName(name2);
|
||||||
|
Material m2 = new StandardMaterialsReader().readIncompressibleMaterial(dict2);
|
||||||
|
materials.add(m2);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (transportProperties.found(SIGMA_KEY)) {
|
||||||
|
double sigma = transportProperties.lookupScalar(SIGMA_KEY).doubleValue();
|
||||||
|
module.setSigma(sigma);
|
||||||
|
} else if (dict1.found(SIGMA_KEY)) {
|
||||||
|
double sigma = dict1.lookupScalar(SIGMA_KEY).doubleValue();
|
||||||
|
module.setSigma(sigma);
|
||||||
|
} else if (dict2.found(SIGMA_KEY)) {
|
||||||
|
double sigma = dict2.lookupScalar(SIGMA_KEY).doubleValue();
|
||||||
|
module.setSigma(sigma);
|
||||||
|
}
|
||||||
|
|
||||||
|
model.materialsChanged();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
logger.warn("Multiphase case but no phases found in transportProperties");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void readCompressibleMaterials() {
|
||||||
|
logger.error("Multiphase Compressible not supported");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
178
src/eu/engys/combustion/CombustionSolutionView.java
Normal file
178
src/eu/engys/combustion/CombustionSolutionView.java
Normal file
|
|
@ -0,0 +1,178 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* | 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.combustion;
|
||||||
|
|
||||||
|
import java.awt.BorderLayout;
|
||||||
|
import java.awt.Component;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.swing.DefaultComboBoxModel;
|
||||||
|
import javax.swing.JCheckBox;
|
||||||
|
import javax.swing.JComboBox;
|
||||||
|
import javax.swing.JLabel;
|
||||||
|
import javax.swing.JList;
|
||||||
|
import javax.swing.ListCellRenderer;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import eu.engys.core.modules.solutionmodelling.AbstractSolutionView;
|
||||||
|
import eu.engys.core.modules.solutionmodelling.MultiphaseBuilder;
|
||||||
|
import eu.engys.core.project.state.MultiphaseModel;
|
||||||
|
import eu.engys.core.project.state.SolutionState;
|
||||||
|
import eu.engys.core.project.state.State;
|
||||||
|
import eu.engys.core.project.state.ThermalState;
|
||||||
|
import eu.engys.util.ui.builder.PanelBuilder;
|
||||||
|
import eu.engys.util.ui.textfields.SpinnerField;
|
||||||
|
|
||||||
|
public class CombustionSolutionView extends AbstractSolutionView {
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(CombustionSolutionView.class);
|
||||||
|
|
||||||
|
private CombustionModule module;
|
||||||
|
private ActionListener listener;
|
||||||
|
private PanelBuilder builder;
|
||||||
|
|
||||||
|
private JCheckBox reaction;
|
||||||
|
|
||||||
|
JComboBox<String> modelsCombo;
|
||||||
|
|
||||||
|
public CombustionSolutionView(CombustionModule module) {
|
||||||
|
this.module = module;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasChanged(State state) {
|
||||||
|
if (module != null && reaction != null) {
|
||||||
|
return (module.isReacting() != reaction.isSelected());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void buildThermal(PanelBuilder builder) {
|
||||||
|
this.builder = builder;
|
||||||
|
this.reaction = (JCheckBox) builder.startCheck("Reaction");
|
||||||
|
|
||||||
|
modelsCombo = new JComboBox<String>();
|
||||||
|
modelsCombo.setPrototypeDisplayValue("Laminar");
|
||||||
|
final ListCellRenderer<? super String> renderer = modelsCombo.getRenderer();
|
||||||
|
modelsCombo.setRenderer(new ListCellRenderer<String>() {
|
||||||
|
@Override
|
||||||
|
public Component getListCellRendererComponent(JList<? extends String> list, String value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||||
|
Component c = renderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
||||||
|
if (c instanceof JLabel && value instanceof String) {
|
||||||
|
String model = (String) value;
|
||||||
|
((JLabel) c).setText(model);
|
||||||
|
}
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
builder.addComponent("Combustion Model", modelsCombo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fixSolutionState(SolutionState ss) {
|
||||||
|
if (ss.areSolverTypeAndTimeAndFlowAndTurbulenceChoosen()) {
|
||||||
|
boolean isVOFState = ss.isTransient() && ss.isIncompressible();
|
||||||
|
if (isVOFState) {
|
||||||
|
// builder.enableChoice(CombustionModule.VOF_MODEL);
|
||||||
|
} else {
|
||||||
|
// builder.disableChoice(CombustionModule.VOF_MODEL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fixThermal(SolutionState ss, ThermalState ts) {
|
||||||
|
module.setReacting(ts.isReacting());
|
||||||
|
|
||||||
|
if (ss.areSolverTypeAndTimeAndFlowAndTurbulenceChoosen()) {
|
||||||
|
if (ss.isCoupled()) {
|
||||||
|
if (reaction.isSelected()) {
|
||||||
|
reaction.setEnabled(true);
|
||||||
|
reaction.doClick();
|
||||||
|
}
|
||||||
|
reaction.setEnabled(false);
|
||||||
|
} else {
|
||||||
|
boolean isTransientCompressibleLES = ss.isTransient() && ss.isCompressible() && ss.isLES();
|
||||||
|
reaction.setEnabled(true);
|
||||||
|
if (reaction.isSelected() && (!ts.isEnergy() || isTransientCompressibleLES || ss.isHighMach())) {
|
||||||
|
reaction.doClick();
|
||||||
|
}
|
||||||
|
reaction.setEnabled(ts.isEnergy() && !isTransientCompressibleLES && ss.isLowMach());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
reaction.setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
String selectedItem = modelsCombo.getItemAt(modelsCombo.getSelectedIndex());
|
||||||
|
|
||||||
|
List<String> models = Arrays.asList(new String[]{"Laminar", "PaSR"});
|
||||||
|
|
||||||
|
modelsCombo.removeAllItems();
|
||||||
|
String laminar = null;
|
||||||
|
for (String combModel : models) {
|
||||||
|
modelsCombo.addItem(combModel);
|
||||||
|
if (combModel == "Laminar") {
|
||||||
|
laminar = combModel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (((DefaultComboBoxModel<String>) modelsCombo.getModel()).getIndexOf(selectedItem) < 0) {
|
||||||
|
modelsCombo.setSelectedItem(laminar);
|
||||||
|
} else {
|
||||||
|
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());
|
||||||
|
}
|
||||||
|
}
|
||||||
52
src/eu/engys/combustion/CombustionTreeView.java
Normal file
52
src/eu/engys/combustion/CombustionTreeView.java
Normal file
|
|
@ -0,0 +1,52 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* | 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.combustion;
|
||||||
|
|
||||||
|
import eu.engys.core.modules.ModulePanel;
|
||||||
|
import eu.engys.core.modules.tree.AbstractTreeViewAdapter;
|
||||||
|
import eu.engys.core.modules.tree.ModuleElementPanel;
|
||||||
|
import eu.engys.gui.casesetup.phases.PhasesPanel;
|
||||||
|
import eu.engys.gui.casesetup.reactions.ReactionsPanel;
|
||||||
|
|
||||||
|
public class CombustionTreeView extends AbstractTreeViewAdapter {
|
||||||
|
|
||||||
|
private CombustionModule module;
|
||||||
|
private ModulePanel reactionsPanel;
|
||||||
|
|
||||||
|
public CombustionTreeView(CombustionModule module, ReactionsPanel reactionsPanel) {
|
||||||
|
this.module = module;
|
||||||
|
this.reactionsPanel = reactionsPanel;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateCaseSetupTree(ModuleElementPanel viewElementPanel) {
|
||||||
|
if (module.isReacting()) {
|
||||||
|
viewElementPanel.addPanel(reactionsPanel);
|
||||||
|
} else {
|
||||||
|
viewElementPanel.removePanel(reactionsPanel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
101
src/eu/engys/combustion/CombustionWriter.java
Normal file
101
src/eu/engys/combustion/CombustionWriter.java
Normal file
|
|
@ -0,0 +1,101 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* | 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.combustion;
|
||||||
|
|
||||||
|
import static eu.engys.core.project.constant.TransportProperties.PHASES_KEY;
|
||||||
|
import static eu.engys.core.project.constant.TransportProperties.SIGMA_KEY;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import eu.engys.core.dictionary.Dictionary;
|
||||||
|
import eu.engys.core.dictionary.DimensionedScalar;
|
||||||
|
import eu.engys.core.project.Model;
|
||||||
|
import eu.engys.core.project.constant.ConstantFolder;
|
||||||
|
import eu.engys.core.project.constant.TransportProperties;
|
||||||
|
import eu.engys.core.project.materials.Material;
|
||||||
|
import eu.engys.core.project.materials.Materials;
|
||||||
|
import eu.engys.gui.casesetup.materials.StandardMaterialsWriter;
|
||||||
|
|
||||||
|
public class CombustionWriter {
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(CombustionWriter.class);
|
||||||
|
|
||||||
|
private Model model;
|
||||||
|
private CombustionModule module;
|
||||||
|
|
||||||
|
public CombustionWriter(Model model, CombustionModule module) {
|
||||||
|
this.model = model;
|
||||||
|
this.module = module;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void write() {
|
||||||
|
if (module.isReacting()) {
|
||||||
|
if (model.getState().isIncompressible()) {
|
||||||
|
writeIncompressibleMaterials();
|
||||||
|
} else {
|
||||||
|
writeCompressibleMaterials();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void writeCompressibleMaterials() {
|
||||||
|
logger.error("Multiphase Compressible not supported");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void writeIncompressibleMaterials() {
|
||||||
|
Materials materials = model.getMaterials();
|
||||||
|
ConstantFolder constantFolder = model.getProject().getConstantFolder();
|
||||||
|
TransportProperties transportProperties = constantFolder.getTransportProperties();
|
||||||
|
|
||||||
|
if (materials.size() == 2) {
|
||||||
|
transportProperties.clear();
|
||||||
|
|
||||||
|
Material mat1 = materials.get(0);
|
||||||
|
String mat1Name = mat1.getName();
|
||||||
|
Material mat2 = materials.get(1);
|
||||||
|
String mat2Name = mat2.getName();
|
||||||
|
|
||||||
|
transportProperties.add(PHASES_KEY, "(" + mat1Name + " " + mat2Name + ")");
|
||||||
|
|
||||||
|
Dictionary dict1 = new StandardMaterialsWriter(model).writeSingle_IncompressibleMaterial(mat1);
|
||||||
|
dict1.remove(SIGMA_KEY);
|
||||||
|
dict1.setName(mat1Name);
|
||||||
|
transportProperties.add(dict1);
|
||||||
|
|
||||||
|
Dictionary dict2 = new StandardMaterialsWriter(model).writeSingle_IncompressibleMaterial(mat2);
|
||||||
|
dict2.remove(SIGMA_KEY);
|
||||||
|
dict2.setName(mat2Name);
|
||||||
|
transportProperties.add(dict2);
|
||||||
|
|
||||||
|
double sigmaValue = module.getSigma();
|
||||||
|
transportProperties.add(new DimensionedScalar(SIGMA_KEY, String.valueOf(sigmaValue), "[1 0 -2 0 0 0 0 ]"));
|
||||||
|
|
||||||
|
} else {
|
||||||
|
logger.warn("Multiphase solution choosen but '{}' materials found", materials.size());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
469
src/eu/engys/combustion/resources/combustion.stateData
Normal file
469
src/eu/engys/combustion/resources/combustion.stateData
Normal file
|
|
@ -0,0 +1,469 @@
|
||||||
|
states
|
||||||
|
{
|
||||||
|
reactingFoamRAS (transient compressible ras );
|
||||||
|
reactingFoamRAS2 (PIMPLE compressible ras );
|
||||||
|
reactingFoamRAS3 (PIMPLE compressible ras );
|
||||||
|
|
||||||
|
reactingFoamLES (transient compressible les );
|
||||||
|
reactingFoamLES2 (PIMPLE compressible les );
|
||||||
|
reactingFoamLES3 (PIMPLE compressible les );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
"reactingFoamRAS.*"
|
||||||
|
{
|
||||||
|
fieldMaps
|
||||||
|
{
|
||||||
|
U U;
|
||||||
|
p_rgh pmultiphase;
|
||||||
|
alpha phase;
|
||||||
|
}
|
||||||
|
materialProperties
|
||||||
|
{
|
||||||
|
air{}
|
||||||
|
water{}
|
||||||
|
}
|
||||||
|
system
|
||||||
|
{
|
||||||
|
controlDict
|
||||||
|
{
|
||||||
|
startFrom startTime;
|
||||||
|
startTime 0;
|
||||||
|
stopAt endTime;
|
||||||
|
endTime 10;
|
||||||
|
deltaT 0.001;
|
||||||
|
writeControl adjustableRunTime;
|
||||||
|
writeInterval 0.1;
|
||||||
|
purgeWrite 0;
|
||||||
|
writeFormat ascii;
|
||||||
|
writePrecision 10;
|
||||||
|
writeCompression uncompressed;
|
||||||
|
timeFormat general;
|
||||||
|
timePrecision 6;
|
||||||
|
graphFormat raw;
|
||||||
|
runTimeModifiable yes;
|
||||||
|
adjustTimeStep yes;
|
||||||
|
maxCo 0.5;
|
||||||
|
maxAlphaCo 0.25;
|
||||||
|
maxDeltaT 1.0;
|
||||||
|
}
|
||||||
|
fvSchemes
|
||||||
|
{
|
||||||
|
ddtSchemes {$fvSchemes_ddtSchemes_ras_trans;}
|
||||||
|
|
||||||
|
gradSchemes
|
||||||
|
{
|
||||||
|
$fvSchemes_gradSchemes;
|
||||||
|
grad(U) cellLimited Gauss linear 1;
|
||||||
|
grad(rho) cellLimited Gauss linear 1;
|
||||||
|
grad(p_rgh) cellLimited Gauss linear 1;
|
||||||
|
grad(pcorr) cellLimited Gauss linear 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
divSchemes
|
||||||
|
{
|
||||||
|
$fvSchemes_divSchemes_trans;
|
||||||
|
div(rhoPhi,U) Gauss linearUpwindV grad(U);
|
||||||
|
div(phi,alpha) Gauss vanLeer;
|
||||||
|
div(phirb,alpha) Gauss interfaceCompression;
|
||||||
|
div((nuEff*dev(T(grad(U))))) Gauss linear;
|
||||||
|
}
|
||||||
|
|
||||||
|
$fvSchemes_misc;
|
||||||
|
fluxRequired
|
||||||
|
{
|
||||||
|
default no;
|
||||||
|
p_rgh;
|
||||||
|
pcorr;
|
||||||
|
"alpha.*";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fvSolution
|
||||||
|
{
|
||||||
|
PIMPLE
|
||||||
|
{
|
||||||
|
momentumPredictor no;
|
||||||
|
nCorrectors 2;
|
||||||
|
nOuterCorrectors 1;
|
||||||
|
nNonOrthogonalCorrectors 0;
|
||||||
|
nAlphaCorr 1;
|
||||||
|
nAlphaSubCycles 3;
|
||||||
|
cAlpha 1.5;
|
||||||
|
correctPhi yes;
|
||||||
|
pRefCell 0;
|
||||||
|
pRefValue 0;
|
||||||
|
|
||||||
|
residualControl
|
||||||
|
{
|
||||||
|
"(U|k|epsilon|omega|nuTilda|T|p_rgh|p)"
|
||||||
|
{
|
||||||
|
relTol 0;
|
||||||
|
tolerance 1e-5;
|
||||||
|
}
|
||||||
|
"alpha.*"
|
||||||
|
{
|
||||||
|
relTol 0;
|
||||||
|
tolerance 1e-5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
solvers
|
||||||
|
{
|
||||||
|
|
||||||
|
$fvSolution_solvers_PIMPLE;
|
||||||
|
|
||||||
|
"pcorr.*"
|
||||||
|
{
|
||||||
|
solver PCG;
|
||||||
|
preconditioner
|
||||||
|
{
|
||||||
|
preconditioner GAMG;
|
||||||
|
tolerance 1e-5;
|
||||||
|
relTol 0;
|
||||||
|
smoother DICGaussSeidel;
|
||||||
|
nPreSweeps 0;
|
||||||
|
nPostSweeps 2;
|
||||||
|
nFinestSweeps 2;
|
||||||
|
cacheAgglomeration false;
|
||||||
|
nCellsInCoarsestLevel 10;
|
||||||
|
agglomerator faceAreaPair;
|
||||||
|
mergeLevels 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
tolerance 1e-05;
|
||||||
|
relTol 0;
|
||||||
|
maxIter 100;
|
||||||
|
minIter 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
"alpha.*"
|
||||||
|
{
|
||||||
|
solver smoothSolver;
|
||||||
|
smoother GaussSeidel;
|
||||||
|
tolerance 1e-6;
|
||||||
|
relTol 0;
|
||||||
|
nSweeps 1;
|
||||||
|
minIter 1;
|
||||||
|
nAlphaCorr 1;
|
||||||
|
nAlphaSubCycles 3;
|
||||||
|
cAlpha 1.5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
relaxationFactors {$fvSolution_relaxationFactors_trans;}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
constant
|
||||||
|
{
|
||||||
|
g{$g;}
|
||||||
|
transportProperties
|
||||||
|
{
|
||||||
|
sigma sigma [1 0 -2 0 0 0 0 ] 0.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
"reactingFoamLES.*"
|
||||||
|
{
|
||||||
|
fieldMaps
|
||||||
|
{
|
||||||
|
U U;
|
||||||
|
p_rgh pmultiphase;
|
||||||
|
alpha phase;
|
||||||
|
}
|
||||||
|
materialProperties
|
||||||
|
{
|
||||||
|
air{}
|
||||||
|
water{}
|
||||||
|
}
|
||||||
|
system
|
||||||
|
{
|
||||||
|
controlDict
|
||||||
|
{
|
||||||
|
startFrom startTime;
|
||||||
|
startTime 0;
|
||||||
|
stopAt endTime;
|
||||||
|
endTime 10;
|
||||||
|
deltaT 0.001;
|
||||||
|
writeControl adjustableRunTime;
|
||||||
|
writeInterval 0.1;
|
||||||
|
purgeWrite 0;
|
||||||
|
writeFormat ascii;
|
||||||
|
writePrecision 10;
|
||||||
|
writeCompression uncompressed;
|
||||||
|
timeFormat general;
|
||||||
|
timePrecision 6;
|
||||||
|
graphFormat raw;
|
||||||
|
runTimeModifiable yes;
|
||||||
|
adjustTimeStep yes;
|
||||||
|
maxCo 0.5;
|
||||||
|
maxAlphaCo 0.2;
|
||||||
|
maxDeltaT 1.0;
|
||||||
|
}
|
||||||
|
fvSchemes
|
||||||
|
{
|
||||||
|
ddtSchemes
|
||||||
|
{
|
||||||
|
default CrankNicolson 0.9;
|
||||||
|
}
|
||||||
|
|
||||||
|
gradSchemes
|
||||||
|
{
|
||||||
|
$fvSchemes_gradSchemes;
|
||||||
|
grad(U) cellLimited Gauss linear 1;
|
||||||
|
grad(rho) cellLimited Gauss linear 1;
|
||||||
|
grad(p_rgh) cellLimited Gauss linear 1;
|
||||||
|
grad(pcorr) cellLimited Gauss linear 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
divSchemes
|
||||||
|
{
|
||||||
|
$fvSchemes_divSchemes_trans;
|
||||||
|
div(rhoPhi,U) Gauss LUST grad(U);
|
||||||
|
div(phi,alpha) Gauss vanLeer;
|
||||||
|
div(phirb,alpha) Gauss interfaceCompression;
|
||||||
|
div((nuEff*dev(T(grad(U))))) Gauss linear;
|
||||||
|
}
|
||||||
|
|
||||||
|
$fvSchemes_misc;
|
||||||
|
fluxRequired
|
||||||
|
{
|
||||||
|
default no;
|
||||||
|
p_rgh;
|
||||||
|
pcorr;
|
||||||
|
"alpha.*";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fvSolution
|
||||||
|
{
|
||||||
|
PIMPLE
|
||||||
|
{
|
||||||
|
momentumPredictor no;
|
||||||
|
nCorrectors 5;
|
||||||
|
nOuterCorrectors 1;
|
||||||
|
nNonOrthogonalCorrectors 1;
|
||||||
|
correctPhi yes;
|
||||||
|
pRefCell 0;
|
||||||
|
pRefValue 0;
|
||||||
|
|
||||||
|
residualControl
|
||||||
|
{
|
||||||
|
"(U|k|epsilon|omega|nuTilda|T|p_rgh|p)"
|
||||||
|
{
|
||||||
|
relTol 0;
|
||||||
|
tolerance 1e-5;
|
||||||
|
}
|
||||||
|
"alpha.*"
|
||||||
|
{
|
||||||
|
relTol 0;
|
||||||
|
tolerance 1e-5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
solvers
|
||||||
|
{
|
||||||
|
"pcorr.*"
|
||||||
|
{
|
||||||
|
solver PCG;
|
||||||
|
preconditioner
|
||||||
|
{
|
||||||
|
preconditioner GAMG;
|
||||||
|
tolerance 1e-5;
|
||||||
|
relTol 0;
|
||||||
|
smoother DICGaussSeidel;
|
||||||
|
nPreSweeps 0;
|
||||||
|
nPostSweeps 2;
|
||||||
|
nFinestSweeps 2;
|
||||||
|
cacheAgglomeration false;
|
||||||
|
nCellsInCoarsestLevel 10;
|
||||||
|
agglomerator faceAreaPair;
|
||||||
|
mergeLevels 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
tolerance 1e-05;
|
||||||
|
relTol 0;
|
||||||
|
maxIter 100;
|
||||||
|
minIter 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
p_rgh
|
||||||
|
{
|
||||||
|
solver GAMG;
|
||||||
|
tolerance 1e-8;
|
||||||
|
relTol 0.01;
|
||||||
|
smoother DIC;
|
||||||
|
nPreSweeps 0;
|
||||||
|
nPostSweeps 2;
|
||||||
|
nFinestSweeps 2;
|
||||||
|
cacheAgglomeration true;
|
||||||
|
nCellsInCoarsestLevel 10;
|
||||||
|
agglomerator faceAreaPair;
|
||||||
|
mergeLevels 1;
|
||||||
|
minIter 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
p_rghFinal
|
||||||
|
{
|
||||||
|
solver PCG;
|
||||||
|
preconditioner
|
||||||
|
{
|
||||||
|
preconditioner GAMG;
|
||||||
|
tolerance 1e-8;
|
||||||
|
relTol 0;
|
||||||
|
nVcycles 2;
|
||||||
|
smoother DICGaussSeidel;
|
||||||
|
nPreSweeps 2;
|
||||||
|
nPostSweeps 2;
|
||||||
|
nFinestSweeps 2;
|
||||||
|
cacheAgglomeration true;
|
||||||
|
nCellsInCoarsestLevel 10;
|
||||||
|
agglomerator faceAreaPair;
|
||||||
|
mergeLevels 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
tolerance 1e-8;
|
||||||
|
relTol 0;
|
||||||
|
maxIter 20;
|
||||||
|
minIter 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
U
|
||||||
|
{
|
||||||
|
solver smoothSolver;
|
||||||
|
smoother GaussSeidel;
|
||||||
|
tolerance 1e-6;
|
||||||
|
relTol 0.1;
|
||||||
|
nSweeps 1;
|
||||||
|
minIter 1;
|
||||||
|
}
|
||||||
|
k
|
||||||
|
{
|
||||||
|
solver smoothSolver;
|
||||||
|
smoother GaussSeidel;
|
||||||
|
tolerance 1e-6;
|
||||||
|
relTol 0.1;
|
||||||
|
nSweeps 1;
|
||||||
|
minIter 1;
|
||||||
|
}
|
||||||
|
kl
|
||||||
|
{
|
||||||
|
solver smoothSolver;
|
||||||
|
smoother GaussSeidel;
|
||||||
|
tolerance 1e-6;
|
||||||
|
relTol 0.1;
|
||||||
|
nSweeps 1;
|
||||||
|
minIter 1;
|
||||||
|
}
|
||||||
|
epsilon
|
||||||
|
{
|
||||||
|
solver smoothSolver;
|
||||||
|
smoother GaussSeidel;
|
||||||
|
tolerance 1e-6;
|
||||||
|
relTol 0.1;
|
||||||
|
nSweeps 1;
|
||||||
|
minIter 1;
|
||||||
|
}
|
||||||
|
nuTilda
|
||||||
|
{
|
||||||
|
solver smoothSolver;
|
||||||
|
smoother GaussSeidel;
|
||||||
|
tolerance 1e-6;
|
||||||
|
relTol 0.1;
|
||||||
|
nSweeps 1;
|
||||||
|
minIter 1;
|
||||||
|
}
|
||||||
|
omega
|
||||||
|
{
|
||||||
|
solver smoothSolver;
|
||||||
|
smoother GaussSeidel;
|
||||||
|
tolerance 1e-6;
|
||||||
|
relTol 0.1;
|
||||||
|
nSweeps 1;
|
||||||
|
minIter 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
UFinal
|
||||||
|
{
|
||||||
|
solver smoothSolver;
|
||||||
|
smoother GaussSeidel;
|
||||||
|
tolerance 1e-6;
|
||||||
|
relTol 0;
|
||||||
|
nSweeps 1;
|
||||||
|
minIter 1;
|
||||||
|
}
|
||||||
|
kFinal
|
||||||
|
{
|
||||||
|
solver smoothSolver;
|
||||||
|
smoother GaussSeidel;
|
||||||
|
tolerance 1e-6;
|
||||||
|
relTol 0;
|
||||||
|
nSweeps 1;
|
||||||
|
minIter 1;
|
||||||
|
}
|
||||||
|
klFinal
|
||||||
|
{
|
||||||
|
solver smoothSolver;
|
||||||
|
smoother GaussSeidel;
|
||||||
|
tolerance 1e-6;
|
||||||
|
relTol 0;
|
||||||
|
nSweeps 1;
|
||||||
|
minIter 1;
|
||||||
|
}
|
||||||
|
epsilonFinal
|
||||||
|
{
|
||||||
|
solver smoothSolver;
|
||||||
|
smoother GaussSeidel;
|
||||||
|
tolerance 1e-6;
|
||||||
|
relTol 0;
|
||||||
|
nSweeps 1;
|
||||||
|
minIter 1;
|
||||||
|
}
|
||||||
|
nuTildaFinal
|
||||||
|
{
|
||||||
|
solver smoothSolver;
|
||||||
|
smoother GaussSeidel;
|
||||||
|
tolerance 1e-6;
|
||||||
|
relTol 0;
|
||||||
|
nSweeps 1;
|
||||||
|
minIter 1;
|
||||||
|
}
|
||||||
|
omegaFinal
|
||||||
|
{
|
||||||
|
solver smoothSolver;
|
||||||
|
smoother GaussSeidel;
|
||||||
|
tolerance 1e-6;
|
||||||
|
relTol 0;
|
||||||
|
nSweeps 1;
|
||||||
|
minIter 1;
|
||||||
|
}
|
||||||
|
"alpha.*"
|
||||||
|
{
|
||||||
|
solver smoothSolver;
|
||||||
|
smoother GaussSeidel;
|
||||||
|
tolerance 1e-6;
|
||||||
|
relTol 0;
|
||||||
|
nSweeps 1;
|
||||||
|
minIter 1;
|
||||||
|
nAlphaCorr 2;
|
||||||
|
nAlphaSubCycles 1;
|
||||||
|
cAlpha 1.5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
relaxationFactors {$fvSolution_relaxationFactors_trans;}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
constant
|
||||||
|
{
|
||||||
|
g{$g;}
|
||||||
|
transportProperties
|
||||||
|
{
|
||||||
|
sigma sigma [1 0 -2 0 0 0 0 ] 0.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,33 +1,33 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
package eu.engys.core;
|
package eu.engys.core;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FilenameFilter;
|
import java.io.FilenameFilter;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
|
||||||
import org.apache.log4j.Level;
|
import org.apache.log4j.Level;
|
||||||
|
|
||||||
|
|
@ -39,49 +39,53 @@ public class Arguments {
|
||||||
private static final String LINE = " ********************************";
|
private static final String LINE = " ********************************";
|
||||||
private static final String TAB = " ";
|
private static final String TAB = " ";
|
||||||
|
|
||||||
public enum CaseType {
|
public boolean verbose = false;
|
||||||
SERIAL, PARALLEL
|
public boolean no3D = false;
|
||||||
}
|
public boolean load3Dmesh = true;
|
||||||
|
public boolean load3Dgeometry = true;
|
||||||
|
public Level logLevel = Level.ERROR;
|
||||||
|
|
||||||
public static boolean verbose = false;
|
public File baseDir = null;
|
||||||
public static boolean no3D = false;
|
public File studyDir = null;
|
||||||
public static boolean load3Dmesh = true;
|
|
||||||
public static boolean load3Dgeometry = true;
|
|
||||||
public static Level logLevel = Level.ERROR;
|
|
||||||
|
|
||||||
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 int concurrentDesigns = 1;
|
||||||
public static boolean run = false;
|
|
||||||
public static boolean setup = false;
|
|
||||||
public static boolean all = false;
|
|
||||||
public static boolean initialise = false;
|
|
||||||
|
|
||||||
public static boolean server = false;
|
public boolean server = false;
|
||||||
public static CaseType caseType = null;
|
public File[] importFiles = null;
|
||||||
public static File[] stlFiles = null;
|
|
||||||
// public static long timeout = -1L;
|
|
||||||
|
|
||||||
private static final String OPTION_V = "-v";
|
private static final String OPTION_V = "-v";
|
||||||
private static final String OPTION_VV = "-V";
|
private static final String OPTION_VV = "-V";
|
||||||
private static final String OPTION_HELP = "-help";
|
private static final String OPTION_HELP = "-help";
|
||||||
private static final String OPTION_NO3D = "-no3D";
|
private static final String OPTION_NO3D = "-no3D";
|
||||||
private static final String OPTION_CASE = "-case";
|
private static final String OPTION_CASE = "-case";
|
||||||
|
private static final String OPTION_STUDY = "-study";
|
||||||
|
|
||||||
public static final String OPTION_MESH = "-mesh";
|
public static final String OPTION_MESH = "-mesh";
|
||||||
public static final String OPTION_RUN = "-run";
|
public static final String OPTION_RUN = "-run";
|
||||||
public static final String OPTION_SETUP = "-setup";
|
public static final String OPTION_SETUP = "-setup";
|
||||||
public static final String OPTION_ALL = "-all";
|
public static final String OPTION_ALL = "-all";
|
||||||
public static final String OPTION_INITIALISE = "-initialise";
|
public static final String OPTION_INITIALISE = "-initialise";
|
||||||
|
public static final String OPTION_POST = "-post";
|
||||||
|
public static final String OPTION_MEMORY = "-memory=<size>";
|
||||||
|
|
||||||
|
public static final String OPTION_CONCURRENT_DESIGNS = "-concurrent";
|
||||||
|
|
||||||
private static final String OPTION_SERVER = "-server"; /* INTERNAL */
|
private static final String OPTION_SERVER = "-server"; /* INTERNAL */
|
||||||
private static final String OPTION_IMPORT = "-import"; /* INTERNAL */
|
private static final String OPTION_IMPORT = "-import"; /* INTERNAL */
|
||||||
private static final String OPTION_NOMESH = "-no3Dmesh"; /* INTERNAL */
|
private static final String OPTION_NOMESH = "-no3Dmesh"; /* INTERNAL */
|
||||||
private static final String OPTION_NOGEOM = "-no3DGeom"; /* INTERNAL */
|
private static final String OPTION_NOGEOM = "-no3DGeom"; /* INTERNAL */
|
||||||
|
|
||||||
// private static final String OPTION_CORE = "-core"; /* INTERNAL */
|
// private static final String OPTION_CORE = "-core"; /* INTERNAL */
|
||||||
// private static final String OPTION_TIMEOUT = "-timeout"; /* INTERNAL */
|
// private static final String OPTION_TIMEOUT = "-timeout"; /* INTERNAL */
|
||||||
|
|
||||||
public static void init(final String[] argv) {
|
public void parse(final String[] argv) {
|
||||||
for (int i = 0; i < argv.length; i++) {
|
for (int i = 0; i < argv.length; i++) {
|
||||||
final String arg = argv[i];
|
final String arg = argv[i];
|
||||||
|
|
||||||
|
|
@ -98,27 +102,64 @@ public class Arguments {
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
String baseDirPath = argv[++i];
|
String baseDirPath = argv[++i];
|
||||||
final File baseDir = new File(baseDirPath);
|
try {
|
||||||
|
/*
|
||||||
|
* Use toRealPath to avoid bad path display when using "." and ".."
|
||||||
|
*/
|
||||||
|
File baseDir = Paths.get(baseDirPath).toRealPath().toFile();
|
||||||
if (!baseDir.exists()) {
|
if (!baseDir.exists()) {
|
||||||
warning("Case Folder \"" + baseDir.getAbsolutePath() + "\" Does Not Exist!");
|
warning("Case Folder \"" + baseDir.getAbsolutePath() + "\" Does Not Exist!");
|
||||||
} else {
|
} else {
|
||||||
Arguments.baseDir = baseDir;
|
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;
|
break;
|
||||||
|
|
||||||
case OPTION_MESH: mesh = true; break;
|
case OPTION_MESH: this.mesh = true; break;
|
||||||
case OPTION_RUN: run = true; break;
|
case OPTION_RUN: this.run = true; break;
|
||||||
case OPTION_SETUP: setup = true; break;
|
case OPTION_SETUP: this.setup = true; break;
|
||||||
case OPTION_ALL: all = true; break;
|
case OPTION_ALL: this.all = true; break;
|
||||||
case OPTION_INITIALISE: initialise = true; break;
|
case OPTION_INITIALISE: this.initialise = true; break;
|
||||||
case OPTION_SERVER: server = 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_NOGEOM: load3Dgeometry = false; break;
|
||||||
case OPTION_NOMESH: load3Dmesh = false; break;
|
case OPTION_NOMESH: load3Dmesh = false; break;
|
||||||
|
|
||||||
case OPTION_IMPORT:
|
case OPTION_IMPORT:
|
||||||
if (i == argv.length - 1) {
|
if (i == argv.length - 1) {
|
||||||
fatal("Missing import folder");
|
fatal("Missing import file/folder");
|
||||||
printUsage();
|
printUsage();
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
@ -128,13 +169,7 @@ public class Arguments {
|
||||||
fatal("Import Folder Does Not Exist!");
|
fatal("Import Folder Does Not Exist!");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
} else if (importFolder.isFile()) {
|
} else if (importFolder.isFile()) {
|
||||||
String name = importFolder.getName();
|
this.importFiles = new File[] { importFolder };
|
||||||
if (name.endsWith("stl") || name.endsWith("STL")) {
|
|
||||||
Arguments.stlFiles = new File[]{importFolder};
|
|
||||||
} else {
|
|
||||||
fatal("Import Folder Does Not Exist!");
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
File[] stls = importFolder.listFiles(new FilenameFilter() {
|
File[] stls = importFolder.listFiles(new FilenameFilter() {
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -146,7 +181,7 @@ public class Arguments {
|
||||||
fatal("No files to import!");
|
fatal("No files to import!");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
} else {
|
} else {
|
||||||
Arguments.stlFiles = stls;
|
this.importFiles = stls;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -162,13 +197,13 @@ public class Arguments {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
checkCase();
|
checkCaseOrStudy();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void checkCase() {
|
private void checkCaseOrStudy() {
|
||||||
if (hasCommand()) {
|
if (hasCommand()) {
|
||||||
if (Arguments.baseDir == null) {
|
if (baseDir == null && studyDir == null) {
|
||||||
fatal("Missing case folder");
|
fatal("Missing case (or study) folder");
|
||||||
printUsage();
|
printUsage();
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
@ -209,8 +244,12 @@ public class Arguments {
|
||||||
System.err.println(" " + Util.padWithSpaces(OPTION_HELP, 12) + " Print this help screen.");
|
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_V, 12) + " The verbose output.");
|
||||||
System.err.println(" " + Util.padWithSpaces(OPTION_VV, 12) + " The very 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(" " + 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();
|
||||||
System.err.println(" Commands:");
|
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_MESH, 12) + " Launch mesh creation according to system/snappyHexMeshDict.");
|
||||||
|
|
@ -218,15 +257,16 @@ public class Arguments {
|
||||||
System.err.println(" " + Util.padWithSpaces(OPTION_INITIALISE, 12) + " Initialise the fields 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_RUN, 12) + " Launch the solver.");
|
||||||
System.err.println(" " + Util.padWithSpaces(OPTION_ALL, 12) + " Launch mesh + setup + run.");
|
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(" -----------------------------------------------------");
|
System.err.println(" -----------------------------------------------------");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isBatch() {
|
public boolean isBatch() {
|
||||||
return Arguments.server || hasCommand();
|
return server || hasCommand();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean hasCommand() {
|
private boolean hasCommand() {
|
||||||
return Arguments.mesh || Arguments.setup || Arguments.run || Arguments.all || Arguments.initialise;
|
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 o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
package eu.engys.core;
|
package eu.engys.core;
|
||||||
|
|
||||||
import static eu.engys.core.project.openFOAMProject.LOG;
|
import static eu.engys.core.project.openFOAMProject.LOG;
|
||||||
|
|
@ -38,6 +37,7 @@ import java.util.Map;
|
||||||
import javax.swing.JFrame;
|
import javax.swing.JFrame;
|
||||||
|
|
||||||
import org.apache.commons.exec.CommandLine;
|
import org.apache.commons.exec.CommandLine;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
|
@ -106,10 +106,6 @@ public class OpenFOAMEnvironment {
|
||||||
return getEnvironment(model, "");
|
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) {
|
public static Map<String, String> getEnvironment(Model model, String logFileName) {
|
||||||
return getEnvironment(model, model.getProject().getBaseDir(), logFileName, null);
|
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("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("PV_VERSION", getParaviewVersion());
|
||||||
|
|
||||||
map.put("ENV_LOADER", getEnvLoader().getAbsolutePath());
|
map.put("ENV_LOADER", getEnvLoader() != null ? getEnvLoader().getAbsolutePath() : "");
|
||||||
|
|
||||||
if (option != null) {
|
if (option != null) {
|
||||||
JavaExecutor executor = Executor.jvm("eu.engys.launcher.Launcher", option, "-V");
|
JavaExecutor executor = Executor.jvm("eu.engys.launcher.Launcher", option, "-V");
|
||||||
|
|
@ -219,6 +215,8 @@ public class OpenFOAMEnvironment {
|
||||||
} else {
|
} else {
|
||||||
UiUtil.showCoreEnvironmentNotLoadedWarning(frame);
|
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()) {
|
if (!OpenFOAMEnvironment.isParaviewPathSet() && OpenFOAMEnvironment.isEnvironementLoaded()) {
|
||||||
File paraviewExecutable = getParaViewExecutablePath();
|
File paraviewExecutable = getParaViewExecutablePath();
|
||||||
if (paraviewExecutable != null) {
|
if (paraviewExecutable != null) {
|
||||||
|
|
@ -249,6 +247,15 @@ public class OpenFOAMEnvironment {
|
||||||
logger.warn("ParaView path NOT set");
|
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() {
|
public static File[] getOpenFoamDir() {
|
||||||
|
|
@ -259,7 +266,6 @@ public class OpenFOAMEnvironment {
|
||||||
File vendorHome = Paths.get(jarPath).getParent().getParent().getParent().getParent().toFile();
|
File vendorHome = Paths.get(jarPath).getParent().getParent().getParent().getParent().toFile();
|
||||||
logger.info("Check for valid OpenFOAM folder in {}", vendorHome);
|
logger.info("Check for valid OpenFOAM folder in {}", vendorHome);
|
||||||
openFoamFolders = vendorHome.listFiles(new FileFilter() {
|
openFoamFolders = vendorHome.listFiles(new FileFilter() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean accept(File file) {
|
public boolean accept(File file) {
|
||||||
return file.isDirectory() && file.getName().startsWith("OpenFOAM");
|
return file.isDirectory() && file.getName().startsWith("OpenFOAM");
|
||||||
|
|
@ -271,16 +277,40 @@ public class OpenFOAMEnvironment {
|
||||||
return openFoamFolders;
|
return openFoamFolders;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static File getParaViewExecutablePath() {
|
private static File getParaViewBatchExecutablePath() {
|
||||||
File[] paraviewFolders = new File[0];
|
File[] paraview_OSMESA_Folders = new File[0];
|
||||||
File[] thirdPartyDirs = getThirdPartyDir();
|
File[] thirdPartyDirs = getThirdPartyDir(getOpenFoamVersion());
|
||||||
if (Util.isVarArgsNotNullAndOfSize(1, thirdPartyDirs)) {
|
if (Util.isVarArgsNotNullAndOfSize(1, thirdPartyDirs)) {
|
||||||
File thirdPartyDir = thirdPartyDirs[0];
|
File thirdPartyDir = thirdPartyDirs[0];
|
||||||
logger.info("Check for valid ParaView folder in {}", thirdPartyDir);
|
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() {
|
paraviewFolders = thirdPartyDir.listFiles(new FileFilter() {
|
||||||
@Override
|
@Override
|
||||||
public boolean accept(File file) {
|
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;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static File[] getThirdPartyDir() {
|
private static File[] getThirdPartyDir(final String version) {
|
||||||
File[] openFoamFolders = getOpenFoamDir();
|
|
||||||
File[] thirdPartyFolders = new File[0];
|
File[] thirdPartyFolders = new File[0];
|
||||||
if (Util.isVarArgsNotNullAndOfSize(1, openFoamFolders)) {
|
if (OpenFOAMEnvironment.isEnvironementLoaded()) {
|
||||||
File vendorHome = getOpenFoamDir()[0].getParentFile();
|
File openFoamDir = PrefUtil.getOpenFoamEntry();
|
||||||
logger.info("Check for valid ThirdParty folder in {}", vendorHome);
|
File vendorHome = openFoamDir.getParentFile();
|
||||||
|
logger.info("Check for valid ThirdParty folder in {} for version {}", vendorHome, version);
|
||||||
thirdPartyFolders = vendorHome.listFiles(new FileFilter() {
|
thirdPartyFolders = vendorHome.listFiles(new FileFilter() {
|
||||||
@Override
|
@Override
|
||||||
public boolean accept(File file) {
|
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;
|
return thirdPartyFolders;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static File[] getOpenFoamDirOS_onUnix() {
|
public static File[] getOpenFoamDirOS_onUnix() {
|
||||||
File[] openFoamFolders = new File[0];
|
File[] openFoamFolders = new File[0];
|
||||||
File optFolder = new File("/opt");
|
File optFolder = new File("/opt");
|
||||||
logger.info("Check for valid OpenFOAM folder in {}", optFolder);
|
logger.info("Check for valid OpenFOAM folder in {}", optFolder);
|
||||||
openFoamFolders = optFolder.listFiles(new FileFilter() {
|
openFoamFolders = optFolder.listFiles(new FileFilter() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean accept(File file) {
|
public boolean accept(File file) {
|
||||||
boolean isDir = file.isDirectory();
|
boolean isDir = file.isDirectory();
|
||||||
|
|
@ -351,6 +384,9 @@ public class OpenFOAMEnvironment {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isEnvironementLoaded() {
|
public static boolean isEnvironementLoaded() {
|
||||||
|
if(PrefUtil.isUsingDocker()){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
File openFoamDir = PrefUtil.getOpenFoamEntry();
|
File openFoamDir = PrefUtil.getOpenFoamEntry();
|
||||||
if (openFoamDir == null || !openFoamDir.exists() || !openFoamDir.isDirectory()) {
|
if (openFoamDir == null || !openFoamDir.exists() || !openFoamDir.isDirectory()) {
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -366,6 +402,14 @@ public class OpenFOAMEnvironment {
|
||||||
return true;
|
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() {
|
public static boolean isFieldViewPathSet() {
|
||||||
File fieldView = PrefUtil.getFieldViewEntry();
|
File fieldView = PrefUtil.getFieldViewEntry();
|
||||||
if (fieldView == null || !fieldView.exists() || !fieldView.isFile() || !fieldView.canExecute()) {
|
if (fieldView == null || !fieldView.exists() || !fieldView.isFile() || !fieldView.canExecute()) {
|
||||||
|
|
@ -402,9 +446,35 @@ public class OpenFOAMEnvironment {
|
||||||
return new File("");
|
return new File("");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getParaviewVersion() {
|
private static String getOpenFoamVersion() {
|
||||||
File pvHome = PrefUtil.getParaViewEntry();
|
File openFoamEntry = PrefUtil.getOpenFoamEntry();
|
||||||
if (pvHome != null && pvHome.exists()) {
|
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();
|
String name = pvHome.getName();
|
||||||
if (name.startsWith("ParaView-")) {
|
if (name.startsWith("ParaView-")) {
|
||||||
String version = name.substring("ParaView-".length());
|
String version = name.substring("ParaView-".length());
|
||||||
|
|
|
||||||
|
|
@ -1,32 +1,35 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
package eu.engys.core.controller;
|
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.io.File;
|
||||||
import java.rmi.RemoteException;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.swing.Icon;
|
import javax.swing.Icon;
|
||||||
|
|
@ -35,22 +38,28 @@ import javax.swing.JOptionPane;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import eu.engys.core.Arguments;
|
|
||||||
import eu.engys.core.controller.actions.CommandException;
|
import eu.engys.core.controller.actions.CommandException;
|
||||||
import eu.engys.core.controller.actions.DeleteMesh;
|
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.modules.ApplicationModule;
|
||||||
import eu.engys.core.presentation.Action;
|
import eu.engys.core.presentation.Action;
|
||||||
import eu.engys.core.presentation.ActionContainer;
|
import eu.engys.core.presentation.ActionContainer;
|
||||||
import eu.engys.core.presentation.ActionManager;
|
import eu.engys.core.presentation.ActionManager;
|
||||||
import eu.engys.core.project.CaseParameters;
|
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.Model;
|
||||||
import eu.engys.core.project.Project200To210Converter;
|
import eu.engys.core.project.Project200To210Converter;
|
||||||
|
import eu.engys.core.project.Project210To240Converter;
|
||||||
import eu.engys.core.project.ProjectFolderAnalyzer;
|
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.ProjectReader;
|
||||||
import eu.engys.core.project.ProjectWriter;
|
import eu.engys.core.project.ProjectWriter;
|
||||||
import eu.engys.core.project.SolverState;
|
import eu.engys.core.project.SolverState;
|
||||||
import eu.engys.core.project.openFOAMProject;
|
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.system.monitoringfunctionobjects.ParserView;
|
||||||
import eu.engys.core.project.zero.cellzones.CellZonesBuilder;
|
import eu.engys.core.project.zero.cellzones.CellZonesBuilder;
|
||||||
import eu.engys.util.ApplicationInfo;
|
import eu.engys.util.ApplicationInfo;
|
||||||
|
|
@ -65,20 +74,42 @@ import eu.engys.util.ui.UiUtil;
|
||||||
|
|
||||||
public abstract class AbstractController implements Controller, ActionContainer {
|
public abstract class AbstractController implements Controller, ActionContainer {
|
||||||
|
|
||||||
public static final String STOP_SOLVER = "Stop Solver";
|
public static final String SOLVER_RUN = "solver.run";
|
||||||
public static final String KILL_SOLVER = "Kill Solver";
|
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 STOP_EXECUTION = "Stop Execution";
|
||||||
public static final String KILL_PROCESS = "Kill Process";
|
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 CANCEL = "Cancel";
|
||||||
public static final String CONTINUE_IN_BATCH = "Continue in Batch";
|
public static final String CONTINUE_IN_BATCH = "Continue in Batch";
|
||||||
|
|
||||||
private static final Icon EXIT_BIG_ICON = ResourcesUtil.getIcon("application.exit.big.icon");
|
public static final String PARALLEL_WORKS = "application.parallel.works";
|
||||||
private static final String EXIT_LABEL = ResourcesUtil.getString("application.exit.label");
|
|
||||||
|
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);
|
private static final Logger logger = LoggerFactory.getLogger(Controller.class);
|
||||||
|
|
||||||
protected final Model model;
|
protected final Model model;
|
||||||
|
|
@ -90,6 +121,8 @@ public abstract class AbstractController implements Controller, ActionContainer
|
||||||
protected ControllerListener listener;
|
protected ControllerListener listener;
|
||||||
protected CellZonesBuilder cellZonesBuilder;
|
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) {
|
public AbstractController(Model model, Set<ApplicationModule> modules, ProjectReader reader, ProjectWriter writer, CellZonesBuilder cellZonesBuilder, ProgressMonitor monitor, ScriptFactory scriptFactory) {
|
||||||
this.cellZonesBuilder = cellZonesBuilder;
|
this.cellZonesBuilder = cellZonesBuilder;
|
||||||
logger.info("Loading {}", getClass().getSimpleName());
|
logger.info("Loading {}", getClass().getSimpleName());
|
||||||
|
|
@ -106,33 +139,61 @@ public abstract class AbstractController implements Controller, ActionContainer
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createCase(CaseParameters params) {
|
public void createCase(CaseParameters params, OpenOptions oo) {
|
||||||
if (params != null) {
|
if (params == null) {
|
||||||
newCaseInAThread(params);
|
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.setTotal(10);
|
||||||
monitor.start(String.format("Creating %s", params), false, new Runnable() {
|
monitor.start(String.format("Creating %s", params), false, new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
create(params);
|
create(params, oo);
|
||||||
PrefUtil.putFile(PrefUtil.WORK_DIR, model.getProject().getBaseDir().getParentFile());
|
PrefUtil.putFile(PrefUtil.WORK_DIR, model.getProject().getBaseDir().getParentFile());
|
||||||
|
if (oo != null && oo.getFilesToImport() != null) {
|
||||||
|
importFiles(oo.getFilesToImport());
|
||||||
|
}
|
||||||
monitor.end();
|
monitor.end();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void create(final CaseParameters params) {
|
public void create(final CaseParameters params, final OpenOptions oo) {
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
listener.beforeNewCase();
|
listener.beforeNewCase();
|
||||||
}
|
}
|
||||||
clearModel();
|
clearModel();
|
||||||
writer.create(params);
|
writer.create(params);
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
listener.afterNewCase();
|
listener.afterNewCase(oo != null ? oo.isLoadMesh() : true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -141,21 +202,25 @@ public abstract class AbstractController implements Controller, ActionContainer
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void openCase(File file) {
|
public void openCase(OpenOptions oo) {
|
||||||
if (file == null) {
|
if (oo == null) {
|
||||||
file = fileToOpenOrNull();
|
oo = fileToOpenOrNull();
|
||||||
}
|
}
|
||||||
if (file != null) {
|
if (oo != null && oo.getFile() != null) {
|
||||||
ActionManager.getInstance().invoke("application.startup.hide");
|
openInAThread(oo);
|
||||||
openInAThread(file);
|
|
||||||
}
|
}
|
||||||
Arguments.load3Dgeometry = true;
|
|
||||||
Arguments.load3Dmesh = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private File fileToOpenOrNull() {
|
private OpenOptions fileToOpenOrNull() {
|
||||||
final File[] openFile = new File[1];
|
OpenFile r = new OpenFile();
|
||||||
Runnable r = new Runnable() {
|
ExecUtil.invokeAndWait(r);
|
||||||
|
return r.getOpenOptions();
|
||||||
|
}
|
||||||
|
|
||||||
|
class OpenFile implements Runnable {
|
||||||
|
|
||||||
|
private OpenOptions openOptions;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
File workDir = PrefUtil.getWorkDir(PrefUtil.WORK_DIR);
|
File workDir = PrefUtil.getWorkDir(PrefUtil.WORK_DIR);
|
||||||
|
|
@ -169,66 +234,92 @@ public abstract class AbstractController implements Controller, ActionContainer
|
||||||
File selectedCase = fileChooser.getSelectedFile();
|
File selectedCase = fileChooser.getSelectedFile();
|
||||||
if (isSuitable(selectedCase)) {
|
if (isSuitable(selectedCase)) {
|
||||||
PrefUtil.putFile(PrefUtil.WORK_DIR, selectedCase.getParentFile());
|
PrefUtil.putFile(PrefUtil.WORK_DIR, selectedCase.getParentFile());
|
||||||
Arguments.load3Dgeometry = true;
|
openOptions = OpenOptions.file(selectedCase, OpenMode.CHECK_FOLDER_ASK_USER).loadMesh(options.loadMesh());
|
||||||
Arguments.load3Dmesh = options.loadMesh();
|
ActionManager.getInstance().invoke("application.startup.hide");
|
||||||
openFile[0] = selectedCase;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
JOptionPane.showMessageDialog(UiUtil.getActiveWindow(), selectedCase + "\n appears not to be a valid case folder", "File System Error", JOptionPane.ERROR_MESSAGE);
|
JOptionPane.showMessageDialog(UiUtil.getActiveWindow(), selectedCase + "\n appears not to be a valid case folder", "File System Error", JOptionPane.ERROR_MESSAGE);
|
||||||
}
|
}
|
||||||
openFile[0] = null;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
};
|
|
||||||
ExecUtil.invokeAndWait(r);
|
public OpenOptions getOpenOptions() {
|
||||||
return openFile[0];
|
return openOptions;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void openInAThread(final File file) {
|
private void openInAThread(final OpenOptions oo) {
|
||||||
monitor.setTotal(10);
|
monitor.setTotal(10);
|
||||||
monitor.start("Open " + file.getName(), false, new Runnable() {
|
monitor.start("Open " + oo.getFile().getName(), false, new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
open(file);
|
open(oo);
|
||||||
monitor.end();
|
monitor.end();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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();
|
final File baseDir = file.isAbsolute() ? file : file.getAbsoluteFile();
|
||||||
logger.debug("OPEN file {}", baseDir.getAbsolutePath());
|
logger.debug("OPEN file {}", baseDir.getAbsolutePath());
|
||||||
|
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
listener.beforeLoadCase();
|
listener.beforeLoadCase();
|
||||||
}
|
}
|
||||||
clearModel();
|
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 Project200To210Converter(model.getProject(), cellZonesBuilder).convert();
|
||||||
|
new Project210To240Converter(model.getProject()).convert();
|
||||||
|
|
||||||
_read();
|
reader.read();
|
||||||
|
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
listener.afterLoadCase();
|
listener.afterLoadCase(oo.isLoadMesh());
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.debug("OPEN file {} done.", baseDir.getName());
|
logger.debug("OPEN file {} done.", baseDir.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected abstract void importFiles(final File[] stlFiles);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void reopen(OpenOptions options) {
|
public void reopen(OpenMode mode) {
|
||||||
File baseDir = model.getProject().getBaseDir();
|
File baseDir = model.getProject().getBaseDir();
|
||||||
int np = model.getProject().getProcessors();
|
int np = model.getProject().getProcessors();
|
||||||
boolean parallel = model.getProject().isParallel();
|
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) {
|
if (listener != null) {
|
||||||
listener.beforeReopenCase();
|
listener.beforeReopenCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options == OpenOptions.MESH_ONLY) {
|
if (mode == OpenMode.MESH_ONLY) {
|
||||||
reader.readMesh();
|
reader.readMesh();
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
listener.afterReopenCase();
|
listener.afterReopenCase();
|
||||||
|
|
@ -237,15 +328,20 @@ public abstract class AbstractController implements Controller, ActionContainer
|
||||||
}
|
}
|
||||||
clearModel();
|
clearModel();
|
||||||
|
|
||||||
switch (options) {
|
switch (mode) {
|
||||||
case SERIAL:
|
case SERIAL:
|
||||||
model.setProject(openFOAMProject.newSerialProject(baseDir));
|
model.setProject(openFOAMProject.newSerialProject(baseDir));
|
||||||
break;
|
break;
|
||||||
case PARALLEL:
|
case PARALLEL:
|
||||||
model.setProject(openFOAMProject.newParallelProject(baseDir));
|
model.setProject(openFOAMProject.newParallelProject(baseDir));
|
||||||
break;
|
break;
|
||||||
case CHECK_FOLDER:
|
case CHECK_FOLDER_ASK_USER:
|
||||||
model.setProject(openFOAMProject.createProject(baseDir, monitor));
|
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;
|
break;
|
||||||
case CURRENT_SETTINGS:
|
case CURRENT_SETTINGS:
|
||||||
model.setProject(parallel ? openFOAMProject.newParallelProject(baseDir, np) : openFOAMProject.newSerialProject(baseDir));
|
model.setProject(parallel ? openFOAMProject.newParallelProject(baseDir, np) : openFOAMProject.newSerialProject(baseDir));
|
||||||
|
|
@ -264,18 +360,8 @@ public abstract class AbstractController implements Controller, ActionContainer
|
||||||
logger.debug("Open file {} done.", baseDir.getName());
|
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
|
@Override
|
||||||
public void reopenCase(final OpenOptions options) {
|
public void reopenCase(final OpenMode options) {
|
||||||
monitor.start("Reopen " + model.getProject().getBaseDir(), false, new Runnable() {
|
monitor.start("Reopen " + model.getProject().getBaseDir(), false, new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
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.info("");
|
||||||
monitor.start("Save: " + baseDir.getAbsolutePath(), false, new Runnable() {
|
monitor.start("Save: " + baseDir.getAbsolutePath(), false, new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -308,6 +394,9 @@ public abstract class AbstractController implements Controller, ActionContainer
|
||||||
monitor.end();
|
monitor.end();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
if (ActionManager.getInstance().contains(SAVE_SCREENSHOT)) {
|
||||||
|
ActionManager.getInstance().get(SAVE_SCREENSHOT).actionPerformed(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -316,8 +405,9 @@ public abstract class AbstractController implements Controller, ActionContainer
|
||||||
baseDir = model.getProject().getBaseDir();
|
baseDir = model.getProject().getBaseDir();
|
||||||
}
|
}
|
||||||
logger.debug("Save file {}", baseDir.getAbsolutePath());
|
logger.debug("Save file {}", baseDir.getAbsolutePath());
|
||||||
if (listener != null)
|
if (listener != null) {
|
||||||
listener.beforeSaveCase();
|
listener.beforeSaveCase();
|
||||||
|
}
|
||||||
writer.write(baseDir);
|
writer.write(baseDir);
|
||||||
writeScripts();
|
writeScripts();
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
|
|
@ -368,13 +458,16 @@ public abstract class AbstractController implements Controller, ActionContainer
|
||||||
* MESH
|
* MESH
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Action(key = "mesh.delete")
|
@Action(key = MESH_DELETE)
|
||||||
public void deleteMesh() {
|
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);
|
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) {
|
if (retVal == JOptionPane.YES_OPTION) {
|
||||||
saveInAThread(model.getProject().getBaseDir());
|
saveInAThread(model.getProject().getBaseDir());
|
||||||
new DeleteMesh(model, this).executeClient();
|
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
|
@Override
|
||||||
public void createReport() {
|
public void createReport(ExecutorTerminal terminal) {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void clearModel() {
|
@Override
|
||||||
|
public void clearModel() {
|
||||||
logger.info("--- CLEAR MODEL ---");
|
logger.info("--- CLEAR MODEL ---");
|
||||||
model.init();
|
model.init();
|
||||||
model.setProject(null);
|
model.setProject(null);
|
||||||
|
|
@ -418,31 +512,24 @@ public abstract class AbstractController implements Controller, ActionContainer
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean allowActionsOnRunning(boolean exit) {
|
public boolean allowActionsOnRunning(boolean shouldAskConfirmation) {
|
||||||
if (model != null && model.getSolverModel() != null) {
|
String exitMessage = EXIT_LABEL + " " + ApplicationInfo.getName() + "?";
|
||||||
|
|
||||||
|
boolean thereIsACaseLoaded = model != null && model.getSolverModel() != null;
|
||||||
|
if (thereIsACaseLoaded) {
|
||||||
SolverState solverState = model.getSolverModel().getServerState().getSolverState();
|
SolverState solverState = model.getSolverModel().getServerState().getSolverState();
|
||||||
if (solverState.isMeshing()) {
|
if (solverState.isDoingSomething()) {
|
||||||
return handleExitOnMeshRunning();
|
return handleExitOnRunning();
|
||||||
} else if (solverState.isInitialising()) {
|
} else {// server not running
|
||||||
return handleExitOnFieldsInitialising();
|
if (shouldAskConfirmation) {
|
||||||
} else if (solverState.isRunning()) {
|
int option = JOptionPane.showConfirmDialog(UiUtil.getActiveWindow(), exitMessage, EXIT_LABEL, OK_CANCEL_OPTION, INFORMATION_MESSAGE, EXIT_BIG_ICON);
|
||||||
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) {
|
if (option == JOptionPane.CANCEL_OPTION) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
|
||||||
if (getClient() != null && getClient().getServer() != null) {
|
|
||||||
shutdownServer();
|
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
} else if (getClient() != null && getClient().getServer() != null) {
|
|
||||||
shutdownServer();
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
} else if (exit) {// If no case has been loaded yet
|
} else if (shouldAskConfirmation) {
|
||||||
int option = JOptionPane.showConfirmDialog(UiUtil.getActiveWindow(), EXIT_LABEL + " " + ApplicationInfo.getName() + "?", EXIT_LABEL, JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE, EXIT_BIG_ICON);
|
int option = JOptionPane.showConfirmDialog(UiUtil.getActiveWindow(), exitMessage, EXIT_LABEL, OK_CANCEL_OPTION, INFORMATION_MESSAGE, EXIT_BIG_ICON);
|
||||||
if (option == JOptionPane.CANCEL_OPTION) {
|
if (option == JOptionPane.CANCEL_OPTION) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -450,52 +537,15 @@ public abstract class AbstractController implements Controller, ActionContainer
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void shutdownServer() {
|
protected boolean handleExitOnRunning() {
|
||||||
try {
|
Object[] options = new Object[] { KILL_PROCESS, CONTINUE_IN_BATCH, CANCEL };
|
||||||
getClient().getServer().shutdown();
|
String message = ApplicationInfo.getName() + " is running. Select an action to perform.";
|
||||||
} catch (RemoteException e) {
|
String title = ApplicationInfo.getName();
|
||||||
logger.error("Error shutting down server: {}" + e.getMessage());
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.error("Error shutting down server: {}" + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected boolean handleExitOnMeshRunning() {
|
int option = JOptionPane.showOptionDialog(UiUtil.getActiveWindow(), message, title, YES_NO_CANCEL_OPTION, QUESTION_MESSAGE, null, options, options[0]);
|
||||||
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]);
|
|
||||||
|
|
||||||
if (getClient() != null && option == JOptionPane.YES_OPTION) {
|
if (getClient() != null && option == JOptionPane.YES_OPTION) {
|
||||||
kill();
|
getClient().killCommand(Command.ANY);
|
||||||
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);
|
|
||||||
return true;
|
return true;
|
||||||
} else if (getClient() != null && option == JOptionPane.NO_OPTION) {
|
} else if (getClient() != null && option == JOptionPane.NO_OPTION) {
|
||||||
getClient().goToBatch();
|
getClient().goToBatch();
|
||||||
|
|
@ -533,6 +583,11 @@ public abstract class AbstractController implements Controller, ActionContainer
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TerminalManager getTerminalManager() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ParserView getResidualView() {
|
public ParserView getResidualView() {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,27 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
package eu.engys.core.controller;
|
package eu.engys.core.controller;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
@ -35,10 +34,12 @@ import eu.engys.util.Util;
|
||||||
public abstract class AbstractScriptFactory implements ScriptFactory {
|
public abstract class AbstractScriptFactory implements ScriptFactory {
|
||||||
|
|
||||||
protected static final String RUN_MESH = "Run Mesh";
|
protected static final String RUN_MESH = "Run Mesh";
|
||||||
public static final String MESH_SERIAL_RUN = "mesh_serial.run";
|
public static final String MESH_SERIAL = "mesh_serial";
|
||||||
public static final String MESH_SERIAL_BAT = "mesh_serial.bat";
|
public static final String MESH_SERIAL_RUN = MESH_SERIAL + ".run";
|
||||||
public static final String MESH_PARALLEL_RUN = "mesh_parallel.run";
|
public static final String MESH_SERIAL_BAT = MESH_SERIAL + ".bat";
|
||||||
public static final String MESH_PARALLEL_BAT = "mesh_parallel.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";
|
protected static final String CHECK_MESH = "Check Mesh";
|
||||||
public static final String CHECK_MESH_SERIAL_RUN = "check_mesh_serial.run";
|
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_RUN = "check_mesh_parallel.run";
|
||||||
public static final String CHECK_MESH_PARALLEL_BAT = "check_mesh_parallel.bat";
|
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";
|
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_RUN = "solver_serial.run";
|
||||||
public static final String SOLVER_SERIAL_BAT = "solver_serial.bat";
|
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_RUN = "solver_parallel.run";
|
||||||
public static final String SOLVER_PARALLEL_BAT = "solver_parallel.bat";
|
public static final String SOLVER_PARALLEL_BAT = "solver_parallel.bat";
|
||||||
|
|
||||||
protected static final String INITIALISE_FIELDS = "Initialise Fields";
|
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_RUN = "initialiseFields_serial.run";
|
||||||
public static final String INITIALISE_FIELDS_SERIAL_BAT = "initialiseFields_serial.bat";
|
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_RUN = "initialiseFields_parallel.run";
|
||||||
public static final String INITIALISE_FIELDS_PARALLEL_BAT = "initialiseFields_parallel.bat";
|
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_RUN = "extrudeMesh_parallel.run";
|
||||||
private static final String EXTRUDEMESH_PARALLEL_BAT = "extrudeMesh_parallel.bat";
|
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
|
* MESH
|
||||||
*/
|
*/
|
||||||
|
|
@ -102,14 +119,14 @@ public abstract class AbstractScriptFactory implements ScriptFactory {
|
||||||
return script;
|
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);
|
File file = new File(model.getProject().getBaseDir(), Util.isWindowsScriptStyle() ? MESH_PARALLEL_BAT : MESH_PARALLEL_RUN);
|
||||||
writeFileIfNeeded(file, getParallelMeshScript());
|
writeFileIfNeeded(file, getParallelMeshScript());
|
||||||
file.setExecutable(true);
|
file.setExecutable(true);
|
||||||
return file;
|
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);
|
File file = new File(model.getProject().getBaseDir(), Util.isWindowsScriptStyle() ? MESH_SERIAL_BAT : MESH_SERIAL_RUN);
|
||||||
writeFileIfNeeded(file, getSerialMeshScript());
|
writeFileIfNeeded(file, getSerialMeshScript());
|
||||||
file.setExecutable(true);
|
file.setExecutable(true);
|
||||||
|
|
@ -136,9 +153,9 @@ public abstract class AbstractScriptFactory implements ScriptFactory {
|
||||||
public List<String> getDefaultCheckMeshScript(Model model) {
|
public List<String> getDefaultCheckMeshScript(Model model) {
|
||||||
List<String> script = null;
|
List<String> script = null;
|
||||||
if (model.getProject().isParallel()) {
|
if (model.getProject().isParallel()) {
|
||||||
script = getParallelMeshScript();
|
script = getParallelCheckMeshScript();
|
||||||
} else {
|
} else {
|
||||||
script = getSerialMeshScript();
|
script = getSerialCheckMeshScript();
|
||||||
}
|
}
|
||||||
return script;
|
return script;
|
||||||
}
|
}
|
||||||
|
|
@ -161,6 +178,47 @@ public abstract class AbstractScriptFactory implements ScriptFactory {
|
||||||
|
|
||||||
protected abstract List<String> getSerialCheckMeshScript();
|
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
|
* SOLVER
|
||||||
*/
|
*/
|
||||||
|
|
@ -315,18 +373,57 @@ public abstract class AbstractScriptFactory implements ScriptFactory {
|
||||||
protected abstract List<String> getLinuxSetupCaseScript();
|
protected abstract List<String> getLinuxSetupCaseScript();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public File getExportScript(Model model) {
|
public File getReportScript(Model model) {
|
||||||
File file = new File(model.getProject().getBaseDir(), "export.py");
|
File file = new File(model.getProject().getBaseDir(), "export.py");
|
||||||
writeFileIfNeeded(file, getExportScript());
|
writeFileIfNeeded(file, getReportScript());
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getDefaultExportScript(Model model) {
|
public List<String> getDefaultReportScript(Model model) {
|
||||||
return getExportScript();
|
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) {
|
protected void writeFileIfNeeded(File file, List<String> script) {
|
||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
|
|
|
||||||
|
|
@ -1,43 +1,42 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
package eu.engys.core.controller;
|
package eu.engys.core.controller;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
import eu.engys.core.controller.Controller.OpenOptions;
|
import eu.engys.core.controller.Controller.OpenMode;
|
||||||
import eu.engys.core.project.CaseParameters;
|
import eu.engys.core.project.CaseParameters;
|
||||||
|
|
||||||
public interface ApplicationActions {
|
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);
|
void saveCase(File file);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,46 +1,48 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
package eu.engys.core.controller;
|
package eu.engys.core.controller;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
import eu.engys.core.controller.Controller.OpenOptions;
|
import eu.engys.core.controller.Controller.OpenMode;
|
||||||
import eu.engys.core.controller.actions.TimeoutException;
|
|
||||||
import eu.engys.core.project.CaseParameters;
|
import eu.engys.core.project.CaseParameters;
|
||||||
|
|
||||||
public interface BatchActions {
|
public interface BatchActions {
|
||||||
|
|
||||||
void create(CaseParameters params);
|
void create(CaseParameters params, OpenOptions oo);
|
||||||
void open(File file);
|
|
||||||
void reopen(OpenOptions options);
|
void open(OpenOptions oo);
|
||||||
|
|
||||||
|
void reopen(OpenMode options);
|
||||||
|
|
||||||
void save(File file);
|
void save(File file);
|
||||||
|
|
||||||
void setupCase();
|
void setupCase();
|
||||||
void stopCase() throws TimeoutException;
|
|
||||||
|
void stopCase() throws Exception;
|
||||||
|
|
||||||
void kill();
|
void kill();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,27 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
package eu.engys.core.controller;
|
package eu.engys.core.controller;
|
||||||
|
|
||||||
import javax.swing.JComponent;
|
import javax.swing.JComponent;
|
||||||
|
|
@ -35,12 +34,10 @@ public interface Client {
|
||||||
|
|
||||||
void executeCommands(Command... command);
|
void executeCommands(Command... command);
|
||||||
|
|
||||||
ParserView getResidualView();
|
ParserView getResidualsView();
|
||||||
|
|
||||||
void refreshOnce();
|
void refreshOnce();
|
||||||
|
|
||||||
void loadState();
|
|
||||||
|
|
||||||
void stopCommand(Command command);
|
void stopCommand(Command command);
|
||||||
|
|
||||||
void killCommand(Command command);
|
void killCommand(Command command);
|
||||||
|
|
@ -59,4 +56,6 @@ public interface Client {
|
||||||
|
|
||||||
void waitForFinished();
|
void waitForFinished();
|
||||||
|
|
||||||
|
void justConnect();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,50 +1,56 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
package eu.engys.core.controller;
|
package eu.engys.core.controller;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import eu.engys.util.Util;
|
||||||
|
|
||||||
public class ClientInfo implements Serializable {
|
public class ClientInfo implements Serializable {
|
||||||
|
|
||||||
|
private String clientID;
|
||||||
private boolean connected;
|
private boolean connected;
|
||||||
|
|
||||||
private ClientInfo(boolean connected) {
|
private ClientInfo(String clientID, boolean connected) {
|
||||||
|
this.clientID = clientID;
|
||||||
this.connected = connected;
|
this.connected = connected;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isConnected() {
|
public boolean isConnected() {
|
||||||
return connected;
|
return connected;
|
||||||
}
|
}
|
||||||
|
public String getClientID() {
|
||||||
|
return clientID;
|
||||||
|
}
|
||||||
|
|
||||||
public static ClientInfo clientConnected() {
|
public static ClientInfo clientConnected() {
|
||||||
return new ClientInfo(true);
|
return new ClientInfo(Util.generateID(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ClientInfo clientDisconnected() {
|
public static ClientInfo clientDisconnected(String clientID) {
|
||||||
return new ClientInfo(false);
|
return new ClientInfo(clientID, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,28 +1,27 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
package eu.engys.core.controller;
|
package eu.engys.core.controller;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
@ -42,13 +41,6 @@ public class ClientServerCommand implements Serializable {
|
||||||
this.startParsers = 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() {
|
public Command getCommand() {
|
||||||
return commands[0];
|
return commands[0];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,27 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
package eu.engys.core.controller;
|
package eu.engys.core.controller;
|
||||||
|
|
||||||
public enum Command {
|
public enum Command {
|
||||||
|
|
@ -32,6 +31,7 @@ public enum Command {
|
||||||
INITIALISE_FIELDS("", ""),
|
INITIALISE_FIELDS("", ""),
|
||||||
RUN_ALL("", ""),
|
RUN_ALL("", ""),
|
||||||
EXTRUDE_TO_REGION("", ""),
|
EXTRUDE_TO_REGION("", ""),
|
||||||
|
EXPORT_RESULTS("", ""),
|
||||||
ANY("any", "Any"),
|
ANY("any", "Any"),
|
||||||
NONE("none", "None");
|
NONE("none", "None");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,27 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
package eu.engys.core.controller;
|
package eu.engys.core.controller;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
@ -67,6 +66,15 @@ public class CommandInfo implements Serializable {
|
||||||
return ci;
|
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() {
|
public static CommandInfo notConnected() {
|
||||||
CommandInfo ci = new CommandInfo();
|
CommandInfo ci = new CommandInfo();
|
||||||
ci.message = "Not Connected";
|
ci.message = "Not Connected";
|
||||||
|
|
@ -88,4 +96,9 @@ public class CommandInfo implements Serializable {
|
||||||
return ci;
|
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 o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
package eu.engys.core.controller;
|
package eu.engys.core.controller;
|
||||||
|
|
||||||
import eu.engys.core.controller.actions.CommandException;
|
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.ProjectReader;
|
||||||
import eu.engys.core.project.ProjectWriter;
|
import eu.engys.core.project.ProjectWriter;
|
||||||
import eu.engys.core.project.system.monitoringfunctionobjects.ParserView;
|
import eu.engys.core.project.system.monitoringfunctionobjects.ParserView;
|
||||||
|
|
@ -37,8 +38,8 @@ public interface Controller extends ApplicationActions, BatchActions {
|
||||||
EXIT, CONTINUE, NONE
|
EXIT, CONTINUE, NONE
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum OpenOptions {
|
public enum OpenMode {
|
||||||
SERIAL, PARALLEL, CURRENT_SETTINGS, CHECK_FOLDER, MESH_ONLY
|
SERIAL, PARALLEL, CURRENT_SETTINGS, CHECK_FOLDER_ASK_USER, CHECK_FOLDER_PARALLEL, MESH_ONLY
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isDemo();
|
boolean isDemo();
|
||||||
|
|
@ -53,9 +54,9 @@ public interface Controller extends ApplicationActions, BatchActions {
|
||||||
public Server getServer();
|
public Server getServer();
|
||||||
public ParserView getResidualView();
|
public ParserView getResidualView();
|
||||||
|
|
||||||
boolean allowActionsOnRunning(boolean exit);
|
boolean allowActionsOnRunning(boolean shouldAskConfirmation);
|
||||||
|
|
||||||
void createReport();
|
void createReport(ExecutorTerminal terminal);
|
||||||
|
|
||||||
void executeCommand(Command command) throws CommandException;
|
void executeCommand(Command command) throws CommandException;
|
||||||
|
|
||||||
|
|
@ -65,4 +66,10 @@ public interface Controller extends ApplicationActions, BatchActions {
|
||||||
|
|
||||||
boolean isRunningCommand();
|
boolean isRunningCommand();
|
||||||
|
|
||||||
|
void applyParameters(Parameters parameters);
|
||||||
|
|
||||||
|
TerminalManager getTerminalManager();
|
||||||
|
|
||||||
|
void clearModel();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,39 +1,36 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
package eu.engys.core.controller;
|
package eu.engys.core.controller;
|
||||||
|
|
||||||
|
|
||||||
public interface ControllerListener {
|
public interface ControllerListener {
|
||||||
|
|
||||||
void beforeNewCase();
|
void beforeNewCase();
|
||||||
void afterNewCase();
|
void afterNewCase(boolean loadMesh);
|
||||||
|
|
||||||
void beforeLoadCase();
|
void beforeLoadCase();
|
||||||
void afterLoadCase();
|
void afterLoadCase(boolean loadMesh);
|
||||||
|
|
||||||
void beforeReopenCase();
|
void beforeReopenCase();
|
||||||
void afterReopenCase();
|
void afterReopenCase();
|
||||||
|
|
@ -57,4 +54,5 @@ public interface ControllerListener {
|
||||||
|
|
||||||
void afterBlockMesh();
|
void afterBlockMesh();
|
||||||
|
|
||||||
|
void afterSetupCase();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,41 +1,46 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
package eu.engys.core.controller;
|
package eu.engys.core.controller;
|
||||||
|
|
||||||
import eu.engys.core.controller.actions.NamingConvention;
|
import eu.engys.core.controller.actions.NamingConvention;
|
||||||
import eu.engys.core.project.geometry.Surface;
|
import eu.engys.core.project.geometry.Surface;
|
||||||
|
|
||||||
public class DefaultNamingConvention implements NamingConvention {
|
public class DefaultNamingConvention implements NamingConvention {
|
||||||
@Override
|
|
||||||
public String getCellZoneName(Surface surface) {
|
|
||||||
return surface.getZoneName();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPatchName(Surface surface) {
|
public String getPatchName(Surface surface) {
|
||||||
return surface.getPatchName();
|
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 o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
package eu.engys.core.controller;
|
package eu.engys.core.controller;
|
||||||
|
|
||||||
import static eu.engys.core.OpenFOAMEnvironment.loadEnvironment;
|
import static eu.engys.core.OpenFOAMEnvironment.loadEnvironment;
|
||||||
import static eu.engys.core.OpenFOAMEnvironment.printHeader;
|
import static eu.engys.core.OpenFOAMEnvironment.printHeader;
|
||||||
import static eu.engys.core.OpenFOAMEnvironment.printVariables;
|
import static eu.engys.core.OpenFOAMEnvironment.printVariables;
|
||||||
import static eu.engys.util.OpenFOAMCommands.BLOCK_MESH;
|
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;
|
||||||
import static eu.engys.util.OpenFOAMCommands.DECOMPOSE_PAR_ALLREGIONS;
|
import static eu.engys.util.OpenFOAMCommands.DECOMPOSE_PAR_ALLREGIONS;
|
||||||
import static eu.engys.util.OpenFOAMCommands.DECOMPOSE_PAR_CONSTANT_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_CASE_SERIAL;
|
||||||
import static eu.engys.util.OpenFOAMCommands.RUN_MESH_PARALLEL;
|
import static eu.engys.util.OpenFOAMCommands.RUN_MESH_PARALLEL;
|
||||||
import static eu.engys.util.OpenFOAMCommands.RUN_MESH_SERIAL;
|
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_PARALLEL;
|
||||||
import static eu.engys.util.OpenFOAMCommands.SNAPPY_CHECK_MESH_SERIAL;
|
import static eu.engys.util.OpenFOAMCommands.SNAPPY_CHECK_MESH_SERIAL;
|
||||||
|
|
||||||
|
|
@ -102,7 +102,7 @@ public class DefaultScriptFactory extends AbstractScriptFactory {
|
||||||
sb.newLine();
|
sb.newLine();
|
||||||
sb.appendIf(performBlockMesh(), BLOCK_MESH());
|
sb.appendIf(performBlockMesh(), BLOCK_MESH());
|
||||||
sb.newLine();
|
sb.newLine();
|
||||||
sb.appendIf(performBlockMesh(), DECOMPOSE_PAR());
|
sb.appendIf(performBlockMesh(), DECOMPOSE_PAR(Collections.<String> emptySet()));
|
||||||
sb.newLine();
|
sb.newLine();
|
||||||
sb.append(RUN_MESH_PARALLEL());
|
sb.append(RUN_MESH_PARALLEL());
|
||||||
sb.newLine();
|
sb.newLine();
|
||||||
|
|
@ -118,7 +118,7 @@ public class DefaultScriptFactory extends AbstractScriptFactory {
|
||||||
printVariables(sb);
|
printVariables(sb);
|
||||||
loadEnvironment(sb);
|
loadEnvironment(sb);
|
||||||
sb.newLine();
|
sb.newLine();
|
||||||
sb.append(SNAPPY_CHECK_MESH_SERIAL());
|
sb.append(meshOnZero() ? CHECK_MESH_SERIAL() : CHECK_MESH_SERIAL_CONSTANT());
|
||||||
sb.newLine();
|
sb.newLine();
|
||||||
return sb.getLines();
|
return sb.getLines();
|
||||||
}
|
}
|
||||||
|
|
@ -130,6 +130,30 @@ public class DefaultScriptFactory extends AbstractScriptFactory {
|
||||||
printVariables(sb);
|
printVariables(sb);
|
||||||
loadEnvironment(sb);
|
loadEnvironment(sb);
|
||||||
sb.newLine();
|
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.append(SNAPPY_CHECK_MESH_PARALLEL());
|
||||||
sb.newLine();
|
sb.newLine();
|
||||||
return sb.getLines();
|
return sb.getLines();
|
||||||
|
|
@ -216,7 +240,7 @@ public class DefaultScriptFactory extends AbstractScriptFactory {
|
||||||
sb.newLine();
|
sb.newLine();
|
||||||
sb.appendIf(meshOnZero(), RECONSTRUCT_PAR_MESH(), RECONSTRUCT_PAR_MESH_CONSTANT());
|
sb.appendIf(meshOnZero(), RECONSTRUCT_PAR_MESH(), RECONSTRUCT_PAR_MESH_CONSTANT());
|
||||||
sb.append(EXTRUDE_REGION_TO_MESH());
|
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();
|
sb.newLine();
|
||||||
return sb.getLines();
|
return sb.getLines();
|
||||||
}
|
}
|
||||||
|
|
@ -280,17 +304,13 @@ public class DefaultScriptFactory extends AbstractScriptFactory {
|
||||||
InputStream inputStream = DefaultScriptFactory.class.getClassLoader().getResourceAsStream("eu/engys/resources/driver.pbs");
|
InputStream inputStream = DefaultScriptFactory.class.getClassLoader().getResourceAsStream("eu/engys/resources/driver.pbs");
|
||||||
try {
|
try {
|
||||||
String body = IOUtils.readStringFromStream(inputStream);
|
String body = IOUtils.readStringFromStream(inputStream);
|
||||||
return Arrays.asList(body.split(IOUtils.EOL));
|
return Arrays.asList(body.split(IOUtils.LNX_EOL));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<String> getWindowsQueueDriver() {
|
|
||||||
throw new RuntimeException("NOT IMPLEMENTED");
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<String> getLinuxQueueDriver(List<String> body) {
|
private List<String> getLinuxQueueDriver(List<String> body) {
|
||||||
|
|
||||||
String name = model.getProject().getBaseDir().getName();
|
String name = model.getProject().getBaseDir().getName();
|
||||||
|
|
@ -366,7 +386,17 @@ public class DefaultScriptFactory extends AbstractScriptFactory {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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");
|
throw new RuntimeException("NOT IMPLEMENTED");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -380,7 +410,7 @@ public class DefaultScriptFactory extends AbstractScriptFactory {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
return Arrays.asList(driverString.split(IOUtils.EOL));
|
return Arrays.asList(driverString.split(IOUtils.LNX_EOL));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -1,35 +1,36 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
package eu.engys.core.controller;
|
package eu.engys.core.controller;
|
||||||
|
|
||||||
import static eu.engys.core.project.system.SnappyHexMeshDict.BAFFLE_KEY;
|
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.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_TYPE_KEY;
|
||||||
import static eu.engys.core.project.system.SnappyHexMeshDict.FACE_ZONE_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.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.LEVELS_KEY;
|
||||||
import static eu.engys.core.project.system.SnappyHexMeshDict.MODE_KEY;
|
import static eu.engys.core.project.system.SnappyHexMeshDict.MODE_KEY;
|
||||||
import static eu.engys.core.project.system.SnappyHexMeshDict.NONE_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.Region;
|
||||||
import eu.engys.core.project.geometry.surface.Solid;
|
import eu.engys.core.project.geometry.surface.Solid;
|
||||||
import eu.engys.core.project.zero.cellzones.CellZone;
|
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.BoundaryConditions;
|
||||||
import eu.engys.core.project.zero.patches.BoundaryType;
|
import eu.engys.core.project.zero.patches.BoundaryType;
|
||||||
import eu.engys.core.project.zero.patches.Patch;
|
import eu.engys.core.project.zero.patches.Patch;
|
||||||
|
|
||||||
public class GeometryToMesh {
|
public class GeometryToMesh {
|
||||||
|
|
||||||
|
public static final String SLAVE_SUFFIX = "_slave";
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(GeometryToMesh.class);
|
private static final Logger logger = LoggerFactory.getLogger(GeometryToMesh.class);
|
||||||
|
|
||||||
private Model model;
|
private Model model;
|
||||||
private List<Patch> patches = new ArrayList<>();
|
private List<Patch> patches = new ArrayList<>();
|
||||||
private List<CellZone> cellZones = new ArrayList<>();
|
private List<CellZone> cellZones = new ArrayList<>();
|
||||||
|
private List<FaceZone> faceZones = new ArrayList<>();
|
||||||
|
|
||||||
private List<Surface> willBePatches = new ArrayList<>();
|
private List<Surface> willBePatches = new ArrayList<>();
|
||||||
private List<Surface> willBeCellZones = new ArrayList<>();
|
private List<Surface> willBeCellZones = new ArrayList<>();
|
||||||
|
private List<Surface> willBeFaceZones = new ArrayList<>();
|
||||||
|
|
||||||
private NamingConvention naming;
|
private NamingConvention naming;
|
||||||
|
|
||||||
|
|
@ -84,26 +90,27 @@ public class GeometryToMesh {
|
||||||
public void execute() {
|
public void execute() {
|
||||||
model.getPatches().clear();
|
model.getPatches().clear();
|
||||||
model.getCellZones().clear();
|
model.getCellZones().clear();
|
||||||
|
model.getFaceZones().clear();
|
||||||
|
|
||||||
extractPatchesFromGeometry();
|
extractPatchesFromGeometry();
|
||||||
|
|
||||||
model.getPatches().addPatches(patches);
|
model.getPatches().addPatches(patches);
|
||||||
model.getCellZones().addZones(cellZones);
|
model.getCellZones().addZones(cellZones);
|
||||||
}
|
model.getFaceZones().addZones(faceZones);
|
||||||
|
|
||||||
public List<Surface> getWillBePatches() {
|
|
||||||
return willBePatches;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Surface> getWillBeCellZones() {
|
|
||||||
return willBeCellZones;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void extractPatchesFromGeometry() {
|
private void extractPatchesFromGeometry() {
|
||||||
for (Surface surface : model.getGeometry().getSurfaces()) {
|
for (Surface surface : model.getGeometry().getSurfaces()) {
|
||||||
logger.debug("Surface {}: {} {} {}", surface.getName(), surface.getSurfaceDictionary(), surface.getVolumeDictionary(), surface.getZoneDictionary());
|
logger.debug("Surface {}: {} {} {}", surface.getName(), surface.getSurfaceDictionary(), surface.getVolumeDictionary(), surface.getZoneDictionary());
|
||||||
|
|
||||||
surfaceToPatch(surface);
|
surfaceToPatch(surface);
|
||||||
surfaceToCellZone(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()) {
|
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) {
|
private void surfaceToCellZone(Surface surface) {
|
||||||
if (willBeACellZone(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);
|
String zoneName = naming.getCellZoneName(surface);
|
||||||
CellZone zone = new CellZone(zoneName);
|
CellZone zone = new CellZone(zoneName);
|
||||||
zone.setName(zoneName);
|
zone.setName(zoneName);
|
||||||
zone.setVisible(true);
|
zone.setVisible(true);
|
||||||
zone.setLoaded(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);
|
cellZones.add(zone);
|
||||||
willBeCellZones.add(surface);
|
willBeCellZones.add(surface);
|
||||||
} else {
|
} 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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -149,14 +180,47 @@ public class GeometryToMesh {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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) {
|
private boolean willBeACellZone(Surface surface) {
|
||||||
Dictionary zoneDictionary = surface.getZoneDictionary();
|
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) {
|
private boolean willCreatePatches(Surface surface) {
|
||||||
Dictionary zoneDictionary = surface.getZoneDictionary();
|
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) {
|
private boolean isBoundary(Surface surface) {
|
||||||
|
|
@ -169,18 +233,6 @@ public class GeometryToMesh {
|
||||||
return zoneDictionary.lookup(FACE_TYPE_KEY).equals(BAFFLE_KEY);
|
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) {
|
private void addPatch(Surface surface) {
|
||||||
if (willBeAPatch(surface)) {
|
if (willBeAPatch(surface)) {
|
||||||
String patchName = naming.getPatchName(surface);
|
String patchName = naming.getPatchName(surface);
|
||||||
|
|
@ -194,7 +246,7 @@ public class GeometryToMesh {
|
||||||
|
|
||||||
private void addPatchAndSlave(Surface surface) {
|
private void addPatchAndSlave(Surface surface) {
|
||||||
String patchName = naming.getPatchName(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);
|
logger.debug("'{}' becomes 2 PATCHES with name {} and {}", surface.getName(), patchName, slaveName);
|
||||||
patches.add(newPatch(patchName));
|
patches.add(newPatch(patchName));
|
||||||
willBePatches.add(surface);
|
willBePatches.add(surface);
|
||||||
|
|
@ -209,25 +261,19 @@ public class GeometryToMesh {
|
||||||
patch.setVisible(true);
|
patch.setVisible(true);
|
||||||
patch.setLoaded(true);
|
patch.setLoaded(true);
|
||||||
patch.setEmpty(false);
|
patch.setEmpty(false);
|
||||||
patch.setPhisicalType(BoundaryType.getDefaultType());
|
patch.setPhysicalType(BoundaryType.getDefaultType());
|
||||||
patch.setBoundaryConditions(new BoundaryConditions());
|
patch.setBoundaryConditions(new BoundaryConditions());
|
||||||
return patch;
|
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) {
|
private boolean isSurfaceRefinementOnly(Surface surface) {
|
||||||
boolean surfaceRefinement = isSurfaceRefinement(surface);
|
boolean surfaceRefinement = isSurfaceRefinement(surface);
|
||||||
boolean volumeRefinement = isVolumeRefinement(surface);
|
boolean volumeRefinement = isVolumeRefinement(surface);
|
||||||
boolean willBeACellZone = willBeACellZone(surface);
|
boolean willBeACellZone = willBeACellZone(surface);
|
||||||
|
boolean willBeAFaceZone = willBeAFaceZone(surface);
|
||||||
|
|
||||||
// System.err.println("GeometryToMesh.isSurfaceRefinementOnly() surfaceRefinement: "+surfaceRefinement+", volumeRefinement: "+volumeRefinement+", willBeACellZone: "+willBeACellZone);
|
// 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) {
|
private boolean isVolumeRefinement(Surface surface) {
|
||||||
|
|
@ -248,4 +294,20 @@ public class GeometryToMesh {
|
||||||
return naming.getCellZoneName(surface);
|
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 o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
package eu.engys.core.controller;
|
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.io.File;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -42,24 +41,27 @@ import org.slf4j.LoggerFactory;
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
|
||||||
import eu.engys.core.controller.actions.CheckMesh;
|
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.InitialiseFields;
|
||||||
import eu.engys.core.controller.actions.RunCommand;
|
import eu.engys.core.controller.actions.RunCommand;
|
||||||
import eu.engys.core.controller.actions.StandardInitialiseFields;
|
import eu.engys.core.controller.actions.StandardInitialiseFields;
|
||||||
import eu.engys.core.controller.actions.StandardRunCase;
|
import eu.engys.core.controller.actions.StandardRunCase;
|
||||||
import eu.engys.core.controller.actions.StandardRunMesh;
|
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.Executor;
|
||||||
|
import eu.engys.core.executor.TerminalManager;
|
||||||
import eu.engys.core.modules.ApplicationModule;
|
import eu.engys.core.modules.ApplicationModule;
|
||||||
|
import eu.engys.core.parameters.Parameters;
|
||||||
import eu.engys.core.presentation.Action;
|
import eu.engys.core.presentation.Action;
|
||||||
import eu.engys.core.presentation.ActionManager;
|
import eu.engys.core.presentation.ActionManager;
|
||||||
import eu.engys.core.project.Model;
|
import eu.engys.core.project.Model;
|
||||||
import eu.engys.core.project.ProjectReader;
|
import eu.engys.core.project.ProjectReader;
|
||||||
import eu.engys.core.project.ProjectWriter;
|
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.state.ServerState;
|
||||||
import eu.engys.core.project.system.monitoringfunctionobjects.ParserView;
|
import eu.engys.core.project.system.monitoringfunctionobjects.ParserView;
|
||||||
import eu.engys.core.project.system.monitoringfunctionobjects.TimeBlocks;
|
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.cellzones.CellZonesBuilder;
|
||||||
import eu.engys.core.project.zero.fields.Field;
|
|
||||||
import eu.engys.gui.casesetup.fields.StandardInitialisations;
|
import eu.engys.gui.casesetup.fields.StandardInitialisations;
|
||||||
import eu.engys.gui.events.EventManager;
|
import eu.engys.gui.events.EventManager;
|
||||||
import eu.engys.gui.events.EventManager.Event;
|
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.ApplicationEvent;
|
||||||
import eu.engys.gui.events.application.BaseMeshTypeChangedEvent;
|
import eu.engys.gui.events.application.BaseMeshTypeChangedEvent;
|
||||||
import eu.engys.gui.events.application.OpenMonitorEvent;
|
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.ParsersHandler;
|
||||||
import eu.engys.gui.solver.postprocessing.ParsersViewHandler;
|
import eu.engys.gui.solver.postprocessing.ParsersViewHandler;
|
||||||
import eu.engys.gui.solver.postprocessing.panels.residuals.ResidualsView;
|
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.ProgressMonitor;
|
||||||
|
import eu.engys.util.progress.SilentMonitor;
|
||||||
import eu.engys.util.ui.ScriptEditor;
|
import eu.engys.util.ui.ScriptEditor;
|
||||||
import eu.engys.util.ui.UiUtil;
|
import eu.engys.util.ui.UiUtil;
|
||||||
|
|
||||||
public class HelyxOSController extends AbstractController implements GenericEventListener, ParsersManager {
|
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_INITIAL_DELAY = 500L;
|
||||||
private static final long TIMER_REFRESH_RATE = 1000L;
|
private static final long TIMER_REFRESH_RATE = 1000L;
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(HelyxOSController.class);
|
private static final Logger logger = LoggerFactory.getLogger(HelyxOSController.class);
|
||||||
private ResidualsView residualsView;
|
private ParserView residualsView;
|
||||||
private RunCommand command;
|
private RunCommand command;
|
||||||
|
|
||||||
private Timer timer;
|
private Timer timer;
|
||||||
private ParsersHandler parsersHandler;
|
private ParsersHandler parsersHandler;
|
||||||
private ParsersViewHandler viewHandler;
|
private ParsersViewHandler viewHandler;
|
||||||
private ThreadPoolExecutor executor;
|
private ThreadPoolExecutor executor;
|
||||||
|
private TerminalManager terminalManager;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public HelyxOSController(Model model, CellZonesBuilder cellZonesBuilder, Set<ApplicationModule> modules, ProjectReader reader, ProjectWriter writer, CellZonesBuilder zonesBuilder, ProgressMonitor monitor, ScriptFactory scriptFactory) {
|
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);
|
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);
|
EventManager.registerEventListener(this, ApplicationEvent.class);
|
||||||
ActionManager.getInstance().parseActions(this);
|
ActionManager.getInstance().parseActions(this);
|
||||||
|
this.terminalManager = new TerminalManager();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TerminalManager getTerminalManager() {
|
||||||
|
return terminalManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -110,16 +132,25 @@ public class HelyxOSController extends AbstractController implements GenericEven
|
||||||
* MESH
|
* MESH
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Action(key = "mesh.create", checkEnv = true)
|
@Action(key = MESH_CREATE, checkEnv = true)
|
||||||
public void runMesh() {
|
public void runMesh() {
|
||||||
save(model.getProject().getBaseDir());
|
save(model.getProject().getBaseDir());
|
||||||
|
|
||||||
|
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 = new StandardRunMesh(model, this, scriptFactory);
|
||||||
|
}
|
||||||
command.beforeExecute();
|
command.beforeExecute();
|
||||||
command.executeClient();
|
command.executeClient();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Action(key = "mesh.check", checkEnv = true)
|
@Action(key = MESH_CHECK, checkEnv = true)
|
||||||
public void checkMesh() {
|
public void checkMesh() {
|
||||||
model.getProject().getSystemFolder().write(model, null);
|
model.getProject().getSystemFolder().write(model, null);
|
||||||
RunCommand checkMesh = new CheckMesh(model, this, scriptFactory);
|
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() {
|
monitor.start("Open " + model.getProject().getBaseDir(), false, new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
reopen(OpenOptions.CURRENT_SETTINGS);
|
reopen(OpenMode.CURRENT_SETTINGS);
|
||||||
monitor.end();
|
monitor.end();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Action(key = "initialise.fields", checkEnv = true)
|
@Action(key = INITIALISE_SCRIPT, checkEnv = true)
|
||||||
public void initialiseFields() {
|
public void initialiseFields() {
|
||||||
if (model.getProject().getZeroFolder().hasNonZeroTimeFolders()) {
|
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);
|
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();
|
StandardInitialisations initialisations = new StandardInitialisations(model, monitor);
|
||||||
if (cellSetFieldPresent()) {
|
initialisations.initializeFields();
|
||||||
|
|
||||||
|
model.getProject().getZeroFolder().write(model, cellZonesBuilder, modules, initialisations, new SilentMonitor());
|
||||||
|
if (model.getFields().hasCellSetInitialisationField() || model.getFields().hasPotentialFlowInitialisationField()) {
|
||||||
save(model.getProject().getBaseDir());
|
save(model.getProject().getBaseDir());
|
||||||
|
|
||||||
|
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 = new StandardInitialiseFields(model, this, scriptFactory);
|
||||||
|
}
|
||||||
command.beforeExecute();
|
command.beforeExecute();
|
||||||
command.executeClient();
|
command.executeClient();
|
||||||
|
} else {
|
||||||
|
// just clear polymesh
|
||||||
|
((ZeroFileManager) model.getProject().getZeroFolder().getFileManager()).removeNonZeroDirs("0");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean cellSetFieldPresent() {
|
/*
|
||||||
for (Field f : model.getFields().values()) {
|
* DECOMPOSE
|
||||||
if (f.getInitialisationType().equals(CELL_SET_KEY)) {
|
*/
|
||||||
return true;
|
@Action(key = DECOMPOSE)
|
||||||
|
public void decomposeCase() {
|
||||||
|
new DecomposeCaseAction(model, this, true).executeClient();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return false;
|
/*
|
||||||
|
* 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() {
|
private void startTimer() {
|
||||||
startParsers();
|
startParsers();
|
||||||
viewHandler = new ParsersViewHandler(model, this, residualsView);
|
viewHandler = new ParsersViewHandler(model, modules, this, residualsView);
|
||||||
|
|
||||||
executor = Executor.newExecutor("ServerStateMonitor");
|
executor = Executor.newExecutor("ServerStateMonitor");
|
||||||
if (timer == null) {
|
if (timer == null) {
|
||||||
|
|
@ -243,7 +297,18 @@ public class HelyxOSController extends AbstractController implements GenericEven
|
||||||
save(model.getProject().getBaseDir());
|
save(model.getProject().getBaseDir());
|
||||||
|
|
||||||
listener.beforeRunCase();
|
listener.beforeRunCase();
|
||||||
|
|
||||||
|
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 = new StandardRunCase(model, this, scriptFactory);
|
||||||
|
}
|
||||||
|
|
||||||
command.beforeExecute();
|
command.beforeExecute();
|
||||||
command.executeClient();
|
command.executeClient();
|
||||||
|
|
||||||
|
|
@ -252,7 +317,7 @@ public class HelyxOSController extends AbstractController implements GenericEven
|
||||||
|
|
||||||
@Action(key = "solver.refresh.once")
|
@Action(key = "solver.refresh.once")
|
||||||
public void refreshOnce() {
|
public void refreshOnce() {
|
||||||
ParsersViewHandler viewHandler = new ParsersViewHandler(model, this, residualsView);
|
ParsersViewHandler viewHandler = new ParsersViewHandler(model, modules, this, residualsView);
|
||||||
viewHandler.refreshOnce();
|
viewHandler.refreshOnce();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -274,7 +339,7 @@ public class HelyxOSController extends AbstractController implements GenericEven
|
||||||
private void _stopCase() {
|
private void _stopCase() {
|
||||||
try {
|
try {
|
||||||
command.stop();
|
command.stop();
|
||||||
} catch (TimeoutException e) {
|
} catch (Exception e) {
|
||||||
Object[] options = new Object[] { "Wait", "Kill Process" };
|
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]);
|
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) {
|
if (timer != null) {
|
||||||
|
|
@ -306,26 +371,49 @@ public class HelyxOSController extends AbstractController implements GenericEven
|
||||||
command.kill();
|
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
|
* EDIT SCRIPTS
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Action(key = "solver.run.edit")
|
@Action(key = SOLVER_RUN_EDIT)
|
||||||
public void editRunCaseScript() {
|
public void editRunCaseScript() {
|
||||||
ScriptEditor.getInstance().show(scriptFactory.getSolverScript(model).toPath(), scriptFactory.getDefaultSolverScript(model));
|
ScriptEditor.getInstance().show(scriptFactory.getSolverScript(model).toPath(), scriptFactory.getDefaultSolverScript(model));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Action(key = "mesh.create.edit")
|
@Action(key = MESH_CREATE_EDIT)
|
||||||
public void editRunMeshScript() {
|
public void editRunMeshScript() {
|
||||||
ScriptEditor.getInstance().show(scriptFactory.getMeshScript(model).toPath(), scriptFactory.getDefaultMeshScript(model));
|
ScriptEditor.getInstance().show(scriptFactory.getMeshScript(model).toPath(), scriptFactory.getDefaultMeshScript(model));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Action(key = "mesh.check.edit")
|
@Action(key = MESH_CHECK_EDIT)
|
||||||
public void editCheckMeshScript() {
|
public void editCheckMeshScript() {
|
||||||
ScriptEditor.getInstance().show(scriptFactory.getCheckMeshScript(model).toPath(), scriptFactory.getDefaultCheckMeshScript(model));
|
ScriptEditor.getInstance().show(scriptFactory.getCheckMeshScript(model).toPath(), scriptFactory.getDefaultCheckMeshScript(model));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Action(key = "initialise.fields.edit")
|
@Action(key = INITIALISE_SCRIPT_EDIT)
|
||||||
public void editInitialiseScript() {
|
public void editInitialiseScript() {
|
||||||
ScriptEditor.getInstance().show(scriptFactory.getInitialiseScript(model).toPath(), scriptFactory.getDefaultInitialiseScript(model));
|
ScriptEditor.getInstance().show(scriptFactory.getInitialiseScript(model).toPath(), scriptFactory.getDefaultInitialiseScript(model));
|
||||||
}
|
}
|
||||||
|
|
@ -336,7 +424,7 @@ public class HelyxOSController extends AbstractController implements GenericEven
|
||||||
@Override
|
@Override
|
||||||
public void startParsers() {
|
public void startParsers() {
|
||||||
logger.info("[SERVER] START PARSERS");
|
logger.info("[SERVER] START PARSERS");
|
||||||
parsersHandler = new ParsersHandler(model);
|
parsersHandler = new ParsersHandler(model, modules);
|
||||||
parsersHandler.deleteUselessLogFiles();
|
parsersHandler.deleteUselessLogFiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -358,7 +446,7 @@ public class HelyxOSController extends AbstractController implements GenericEven
|
||||||
@Override
|
@Override
|
||||||
public List<TimeBlocks> updateParserOnce(String foName) {
|
public List<TimeBlocks> updateParserOnce(String foName) {
|
||||||
logger.info("[SERVER] UPDATE PARSERS ONCE");
|
logger.info("[SERVER] UPDATE PARSERS ONCE");
|
||||||
ParsersHandler ph = new ParsersHandler(model);
|
ParsersHandler ph = new ParsersHandler(model, modules);
|
||||||
return ph.refreshOnceForFunctionObject(foName);
|
return ph.refreshOnceForFunctionObject(foName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -372,8 +460,8 @@ public class HelyxOSController extends AbstractController implements GenericEven
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void open(File baseDir) {
|
public void open(OpenOptions oo) {
|
||||||
super.open(baseDir);
|
super.open(oo);
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
// client.loadState();
|
// client.loadState();
|
||||||
listener.selectDestinationAndGo();
|
listener.selectDestinationAndGo();
|
||||||
|
|
@ -381,7 +469,7 @@ public class HelyxOSController extends AbstractController implements GenericEven
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void reopen(OpenOptions options) {
|
public void reopen(OpenMode options) {
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
listener.saveLocation();
|
listener.saveLocation();
|
||||||
}
|
}
|
||||||
|
|
@ -411,18 +499,21 @@ public class HelyxOSController extends AbstractController implements GenericEven
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean handleExitOnSolverRunning() {
|
protected boolean handleExitOnRunning() {
|
||||||
Object[] options = new Object[] { STOP_SOLVER, KILL_SOLVER, CANCEL };
|
Object[] options = new Object[] { KILL_PROCESS, 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]);
|
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) {
|
if (option == JOptionPane.YES_OPTION) {
|
||||||
stopCase();
|
|
||||||
return true;
|
|
||||||
} else if (option == JOptionPane.NO_OPTION) {
|
|
||||||
kill();
|
kill();
|
||||||
return true;
|
return true;
|
||||||
} else {
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void applyParameters(Parameters parameters) {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,27 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
package eu.engys.core.controller;
|
package eu.engys.core.controller;
|
||||||
|
|
||||||
import java.io.Serializable;
|
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 o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
package eu.engys.core.controller;
|
package eu.engys.core.controller;
|
||||||
|
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
|
@ -32,10 +31,6 @@ public interface LogClient extends Serializable {
|
||||||
|
|
||||||
void start(String key, OutputStream out, OutputStream err);
|
void start(String key, OutputStream out, OutputStream err);
|
||||||
|
|
||||||
void pump(String key, String lines);
|
|
||||||
|
|
||||||
void close();
|
|
||||||
|
|
||||||
void stop(String key);
|
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 o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
package eu.engys.core.controller;
|
package eu.engys.core.controller;
|
||||||
|
|
||||||
import java.rmi.RemoteException;
|
import java.rmi.RemoteException;
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,27 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
package eu.engys.core.controller;
|
package eu.engys.core.controller;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,27 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
package eu.engys.core.controller;
|
package eu.engys.core.controller;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,27 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
package eu.engys.core.controller;
|
package eu.engys.core.controller;
|
||||||
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
|
@ -33,7 +32,7 @@ public class ScriptBuilder {
|
||||||
private List<String> lines;
|
private List<String> lines;
|
||||||
|
|
||||||
public ScriptBuilder() {
|
public ScriptBuilder() {
|
||||||
lines = new LinkedList<String>();
|
lines = new LinkedList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void append(String s) {
|
public void append(String s) {
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,27 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
package eu.engys.core.controller;
|
package eu.engys.core.controller;
|
||||||
|
|
||||||
|
|
@ -39,6 +38,9 @@ public interface ScriptFactory {
|
||||||
File getCheckMeshScript(Model model);
|
File getCheckMeshScript(Model model);
|
||||||
List<String> getDefaultCheckMeshScript(Model model);
|
List<String> getDefaultCheckMeshScript(Model model);
|
||||||
|
|
||||||
|
File getSnappyCheckMeshScript(Model model);
|
||||||
|
List<String> getDefaultSnappyCheckMeshScript(Model model);
|
||||||
|
|
||||||
File getSolverScript(Model model);
|
File getSolverScript(Model model);
|
||||||
List<String> getDefaultSolverScript(Model model);
|
List<String> getDefaultSolverScript(Model model);
|
||||||
|
|
||||||
|
|
@ -59,4 +61,7 @@ public interface ScriptFactory {
|
||||||
File getExportScript(Model model);
|
File getExportScript(Model model);
|
||||||
List<String> getDefaultExportScript(Model model);
|
List<String> getDefaultExportScript(Model model);
|
||||||
|
|
||||||
|
File getReportScript(Model model);
|
||||||
|
List<String> getDefaultReportScript(Model model);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,27 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
package eu.engys.core.controller;
|
package eu.engys.core.controller;
|
||||||
|
|
||||||
import java.rmi.Remote;
|
import java.rmi.Remote;
|
||||||
|
|
@ -58,12 +57,17 @@ public interface Server extends Remote, ParsersManager {
|
||||||
|
|
||||||
String test() throws RemoteException;
|
String test() throws RemoteException;
|
||||||
|
|
||||||
void disconnect() throws RemoteException;
|
void clientDisconnect() throws RemoteException;
|
||||||
|
|
||||||
QueueInfo getQueueInfo() 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 o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
package eu.engys.core.controller;
|
package eu.engys.core.controller;
|
||||||
|
|
||||||
import java.util.Scanner;
|
import java.util.Scanner;
|
||||||
|
|
@ -39,7 +38,7 @@ public class ServerInfo {
|
||||||
public void decodePorts(String payload) {
|
public void decodePorts(String payload) {
|
||||||
if (payload != null && !payload.isEmpty()) {
|
if (payload != null && !payload.isEmpty()) {
|
||||||
Scanner scanner = new Scanner(payload);
|
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.port1 = scanner.hasNextInt() ? scanner.nextInt() : 0;
|
||||||
this.port2 = scanner.hasNextInt() ? scanner.nextInt() : 0;
|
this.port2 = scanner.hasNextInt() ? scanner.nextInt() : 0;
|
||||||
scanner.close();
|
scanner.close();
|
||||||
|
|
@ -48,6 +47,6 @@ public class ServerInfo {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
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 o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
package eu.engys.core.controller;
|
package eu.engys.core.controller;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
|
||||||
|
|
@ -1,37 +1,35 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
package eu.engys.core.controller;
|
package eu.engys.core.controller;
|
||||||
|
|
||||||
import static eu.engys.core.controller.AbstractController.CANCEL;
|
import static eu.engys.core.controller.AbstractController.CANCEL;
|
||||||
import static eu.engys.core.controller.AbstractController.KILL_SOLVER;
|
import static eu.engys.core.controller.AbstractController.KILL_SOLVER_LABEL;
|
||||||
import static eu.engys.core.controller.AbstractController.STOP_SOLVER;
|
import static eu.engys.core.controller.AbstractController.STOP_SOLVER_LABEL;
|
||||||
|
|
||||||
import javax.swing.JOptionPane;
|
import javax.swing.JOptionPane;
|
||||||
|
|
||||||
import eu.engys.core.controller.actions.TimeoutException;
|
|
||||||
import eu.engys.util.ui.UiUtil;
|
import eu.engys.util.ui.UiUtil;
|
||||||
|
|
||||||
public class StopOrKillCommandOS implements Runnable {
|
public class StopOrKillCommandOS implements Runnable {
|
||||||
|
|
@ -44,12 +42,12 @@ public class StopOrKillCommandOS implements Runnable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
Object[] options = new Object[] { STOP_SOLVER, KILL_SOLVER, CANCEL };
|
Object[] options = new Object[] { STOP_SOLVER_LABEL, KILL_SOLVER_LABEL, 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]);
|
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) {
|
if (option == JOptionPane.YES_OPTION) {
|
||||||
try {
|
try {
|
||||||
controller.stopCase();
|
controller.stopCase();
|
||||||
} catch (TimeoutException e) {
|
} catch (Exception e) {
|
||||||
// should never pass here
|
// should never pass here
|
||||||
}
|
}
|
||||||
} else if (option == JOptionPane.NO_OPTION) {
|
} else if (option == JOptionPane.NO_OPTION) {
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,27 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
package eu.engys.core.controller;
|
package eu.engys.core.controller;
|
||||||
|
|
||||||
import javax.swing.BorderFactory;
|
import javax.swing.BorderFactory;
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,27 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
package eu.engys.core.controller.actions;
|
package eu.engys.core.controller.actions;
|
||||||
|
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
|
|
@ -36,11 +35,14 @@ import eu.engys.core.project.Model;
|
||||||
public abstract class AbstractRunCommand implements RunCommand {
|
public abstract class AbstractRunCommand implements RunCommand {
|
||||||
|
|
||||||
protected Model model;
|
protected Model model;
|
||||||
protected Executor executor;
|
|
||||||
protected Controller controller;
|
protected Controller controller;
|
||||||
|
protected Executor executor;
|
||||||
|
|
||||||
protected ExecutorService service;
|
protected ExecutorService service;
|
||||||
protected ExecutorTerminal terminal;
|
protected ExecutorTerminal terminal;
|
||||||
|
|
||||||
|
protected String jobID = null;
|
||||||
|
|
||||||
public AbstractRunCommand(Model model, Controller controller) {
|
public AbstractRunCommand(Model model, Controller controller) {
|
||||||
this.model = model;
|
this.model = model;
|
||||||
this.controller = controller;
|
this.controller = controller;
|
||||||
|
|
@ -71,7 +73,7 @@ public abstract class AbstractRunCommand implements RunCommand {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void stop() throws TimeoutException {
|
public void stop() throws Exception {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -83,12 +85,16 @@ public abstract class AbstractRunCommand implements RunCommand {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String executeQueue(Server server) throws CommandException {
|
public void executeQueue(Server server) throws CommandException {
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executeBatch() {
|
public void executeBatch() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getJobID() {
|
||||||
|
return jobID;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,27 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
package eu.engys.core.controller.actions;
|
package eu.engys.core.controller.actions;
|
||||||
|
|
||||||
import static eu.engys.core.OpenFOAMEnvironment.getEnvironment;
|
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.io.File;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
import eu.engys.core.controller.Controller;
|
import eu.engys.core.controller.Controller;
|
||||||
import eu.engys.core.controller.Controller.OpenOptions;
|
|
||||||
import eu.engys.core.controller.ScriptFactory;
|
import eu.engys.core.controller.ScriptFactory;
|
||||||
import eu.engys.core.executor.Executor;
|
import eu.engys.core.executor.Executor;
|
||||||
import eu.engys.core.executor.ExecutorHook;
|
import eu.engys.core.executor.ExecutorHook;
|
||||||
import eu.engys.core.executor.ExecutorListener.ExecutorState;
|
import eu.engys.core.executor.ExecutorListener.ExecutorState;
|
||||||
import eu.engys.core.executor.ExecutorMonitor;
|
import eu.engys.core.executor.ExecutorMonitor;
|
||||||
import eu.engys.core.executor.ExecutorTerminal;
|
|
||||||
import eu.engys.core.executor.TerminalExecutorMonitor;
|
import eu.engys.core.executor.TerminalExecutorMonitor;
|
||||||
import eu.engys.core.project.Model;
|
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;
|
import eu.engys.util.IOUtils;
|
||||||
|
|
||||||
public class CheckMesh extends AbstractRunCommand {
|
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 ACTION_NAME = "Check Mesh";
|
||||||
public static final String LOG_NAME = "checkMesh.log";
|
public static final String LOG_NAME = "checkMesh.log";
|
||||||
|
|
||||||
private File logFile;
|
|
||||||
private ScriptFactory scriptFactory;
|
private ScriptFactory scriptFactory;
|
||||||
|
private String logName;
|
||||||
|
private String actionName;
|
||||||
|
private File logFile;
|
||||||
|
|
||||||
public CheckMesh(Model model, Controller controller, ScriptFactory scriptFactory) {
|
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);
|
super(model, controller);
|
||||||
this.scriptFactory = scriptFactory;
|
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
|
@Override
|
||||||
public void beforeExecute() {
|
public void beforeExecute() {
|
||||||
IOUtils.clearFile(logFile);
|
IOUtils.clearFile(logFile);
|
||||||
if (controller.getListener() != null) {
|
|
||||||
controller.getListener().beforeCheckMesh();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executeClient() {
|
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();
|
ExecutorMonitor monitor = new ExecutorMonitor();
|
||||||
monitor.addHook(ExecutorState.FINISH, new FinishHook());
|
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();
|
executor.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
private class FinishHook implements ExecutorHook {
|
private class FinishHook implements ExecutorHook {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(ExecutorMonitor monitor) {
|
public void run(ExecutorMonitor monitor) {
|
||||||
if (controller.getListener() != null) {
|
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();
|
controller.getListener().afterCheckMesh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,27 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
package eu.engys.core.controller.actions;
|
package eu.engys.core.controller.actions;
|
||||||
|
|
||||||
public class CommandException extends Exception {
|
public class CommandException extends Exception {
|
||||||
|
|
@ -31,4 +30,8 @@ public class CommandException extends Exception {
|
||||||
super(message);
|
super(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CommandException(String message, Exception e) {
|
||||||
|
super(message, e);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,29 +1,28 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
package eu.engys.core.controller.actions;
|
||||||
package eu.engys.gui.casesetup.actions;
|
|
||||||
|
|
||||||
import static eu.engys.core.OpenFOAMEnvironment.getEnvironment;
|
import static eu.engys.core.OpenFOAMEnvironment.getEnvironment;
|
||||||
import static eu.engys.core.OpenFOAMEnvironment.loadEnvironment;
|
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.io.File;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
import eu.engys.core.controller.Controller;
|
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.ScriptBuilder;
|
||||||
import eu.engys.core.controller.actions.AbstractRunCommand;
|
|
||||||
import eu.engys.core.executor.Executor;
|
import eu.engys.core.executor.Executor;
|
||||||
import eu.engys.core.executor.ExecutorHook;
|
import eu.engys.core.executor.ExecutorHook;
|
||||||
import eu.engys.core.executor.ExecutorListener.ExecutorState;
|
import eu.engys.core.executor.ExecutorListener.ExecutorState;
|
||||||
|
|
@ -54,20 +53,24 @@ import eu.engys.util.Util;
|
||||||
|
|
||||||
public class DecomposeCase extends AbstractRunCommand {
|
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_RUN = "decomposeCase.run";
|
||||||
private static final String DECOMPOSE_BAT = "decomposeCase.bat";
|
private static final String DECOMPOSE_BAT = "decomposeCase.bat";
|
||||||
|
|
||||||
private File logFile;
|
private File logFile;
|
||||||
private String actionName;
|
private String actionName;
|
||||||
private String logName;
|
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);
|
super(model, controller);
|
||||||
this.actionName = actionName;
|
this.actionName = actionName;
|
||||||
this.logName = logName;
|
this.logName = logName;
|
||||||
|
this.timeSteps = timeSteps;
|
||||||
this.logFile = Paths.get(model.getProject().getBaseDir().getAbsolutePath(), LOG, logName).toFile();
|
this.logFile = Paths.get(model.getProject().getBaseDir().getAbsolutePath(), LOG, logName).toFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void beforeExecute() {
|
public void beforeExecute() {
|
||||||
IOUtils.clearFile(logFile);
|
IOUtils.clearFile(logFile);
|
||||||
|
|
@ -79,7 +82,7 @@ public class DecomposeCase extends AbstractRunCommand {
|
||||||
File baseDir = model.getProject().getBaseDir();
|
File baseDir = model.getProject().getBaseDir();
|
||||||
|
|
||||||
if (terminal == null) {
|
if (terminal == null) {
|
||||||
this.terminal = new TerminalExecutorMonitor(logFile);
|
this.terminal = new TerminalExecutorMonitor(controller.getTerminalManager(), logFile);
|
||||||
}
|
}
|
||||||
if (service == null) {
|
if (service == null) {
|
||||||
this.service = Executors.newSingleThreadExecutor();
|
this.service = Executors.newSingleThreadExecutor();
|
||||||
|
|
@ -104,7 +107,7 @@ public class DecomposeCase extends AbstractRunCommand {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void writeScript(ScriptBuilder sb) {
|
private void writeScript(ScriptBuilder sb) {
|
||||||
printHeader(sb, actionName.toUpperCase());
|
printHeader(sb, ACTION_NAME);
|
||||||
printVariables(sb);
|
printVariables(sb);
|
||||||
loadEnvironment(sb);
|
loadEnvironment(sb);
|
||||||
writeCommand(sb);
|
writeCommand(sb);
|
||||||
|
|
@ -113,15 +116,15 @@ public class DecomposeCase extends AbstractRunCommand {
|
||||||
private void writeCommand(ScriptBuilder sb) {
|
private void writeCommand(ScriptBuilder sb) {
|
||||||
if (model.getProject().isMeshOnZero() || model.getProject().isSerial()) {
|
if (model.getProject().isMeshOnZero() || model.getProject().isSerial()) {
|
||||||
if (model.getProject().getZeroFolder().hasRegions()) {
|
if (model.getProject().getZeroFolder().hasRegions()) {
|
||||||
sb.append(DECOMPOSE_PAR_ALLREGIONS());
|
sb.append(DECOMPOSE_PAR_ALLREGIONS(timeSteps));
|
||||||
} else {
|
} else {
|
||||||
sb.append(DECOMPOSE_PAR());
|
sb.append(DECOMPOSE_PAR(timeSteps));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (model.getProject().getZeroFolder().hasRegions()) {
|
if (model.getProject().getZeroFolder().hasRegions()) {
|
||||||
sb.append(DECOMPOSE_PAR_CONSTANT_ALLREGIONS());
|
sb.append(DECOMPOSE_PAR_CONSTANT_ALLREGIONS(timeSteps));
|
||||||
} else {
|
} else {
|
||||||
sb.append(DECOMPOSE_PAR_CONSTANT());
|
sb.append(DECOMPOSE_PAR_CONSTANT(timeSteps));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -131,7 +134,7 @@ public class DecomposeCase extends AbstractRunCommand {
|
||||||
@Override
|
@Override
|
||||||
public void run(ExecutorMonitor monitor) {
|
public void run(ExecutorMonitor monitor) {
|
||||||
if (controller.getListener() != null) {
|
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 o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
package eu.engys.core.controller.actions;
|
||||||
package eu.engys.gui.casesetup.actions;
|
|
||||||
|
|
||||||
import static eu.engys.core.project.system.DecomposeParDict.DELTA_KEY;
|
import static eu.engys.core.project.system.DecomposeParDict.DELTA_KEY;
|
||||||
import static eu.engys.core.project.system.DecomposeParDict.HIERARCHICAL_COEFFS_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.TYPE_KEYS;
|
||||||
import static eu.engys.core.project.system.DecomposeParDict.YXZ_KEY;
|
import static eu.engys.core.project.system.DecomposeParDict.YXZ_KEY;
|
||||||
import static eu.engys.util.ui.ComponentsFactory.labelArrayField;
|
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.BorderLayout;
|
||||||
import java.awt.FlowLayout;
|
import java.awt.FlowLayout;
|
||||||
|
import java.awt.GridLayout;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.WindowAdapter;
|
import java.awt.event.WindowAdapter;
|
||||||
import java.awt.event.WindowEvent;
|
import java.awt.event.WindowEvent;
|
||||||
import java.beans.PropertyChangeEvent;
|
import java.beans.PropertyChangeEvent;
|
||||||
import java.beans.PropertyChangeListener;
|
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.AbstractAction;
|
||||||
|
import javax.swing.BorderFactory;
|
||||||
import javax.swing.JButton;
|
import javax.swing.JButton;
|
||||||
|
import javax.swing.JCheckBox;
|
||||||
import javax.swing.JComboBox;
|
import javax.swing.JComboBox;
|
||||||
|
import javax.swing.JComponent;
|
||||||
import javax.swing.JDialog;
|
import javax.swing.JDialog;
|
||||||
import javax.swing.JOptionPane;
|
import javax.swing.JOptionPane;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
|
import javax.swing.JScrollPane;
|
||||||
|
|
||||||
import eu.engys.core.dictionary.Dictionary;
|
import eu.engys.core.dictionary.Dictionary;
|
||||||
import eu.engys.core.dictionary.model.DictionaryModel;
|
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 HIERARCHY_LABEL = "Hierarchy";
|
||||||
public static final String PROCESSORS_LABEL = "Processors";
|
public static final String PROCESSORS_LABEL = "Processors";
|
||||||
public static final String DECOMPOSITION_TYPE_LABEL = "Decomposition Type";
|
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 HIERARCHICAL_LABEL = "Hierarchical";
|
||||||
public static final String SCOTCH_LABEL = "Scotch";
|
public static final String SCOTCH_LABEL = "Scotch";
|
||||||
private static final String[] TYPE_LABELS = { HIERARCHICAL_LABEL, SCOTCH_LABEL };
|
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 {
|
public enum Status {
|
||||||
OK, CANCEL;
|
OK, CANCEL;
|
||||||
|
|
@ -103,10 +121,11 @@ public class DecomposeCasePanel extends JPanel {
|
||||||
|
|
||||||
public DecomposeCasePanel(Model model) {
|
public DecomposeCasePanel(Model model) {
|
||||||
super(new BorderLayout());
|
super(new BorderLayout());
|
||||||
setName("decompose.panel");
|
setName(DECOMPOSE_PANEL);
|
||||||
this.model = model;
|
this.model = model;
|
||||||
this.mainModel = new DictionaryModel();
|
this.mainModel = new DictionaryModel();
|
||||||
this.hierarchicalDictionaryModel = new DictionaryModel();
|
this.hierarchicalDictionaryModel = new DictionaryModel();
|
||||||
|
this.timeStepMap = new HashMap<>();
|
||||||
layoutComponents();
|
layoutComponents();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -146,7 +165,49 @@ public class DecomposeCasePanel extends JPanel {
|
||||||
nProcessorsField.addPropertyChangeListener(new RecalculateFactorsOnChange());
|
nProcessorsField.addPropertyChangeListener(new RecalculateFactorsOnChange());
|
||||||
nProcessorsField.setIntValue(1);
|
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() {
|
public void showDialog() {
|
||||||
|
|
@ -158,9 +219,9 @@ public class DecomposeCasePanel extends JPanel {
|
||||||
private void createDialog() {
|
private void createDialog() {
|
||||||
if (dialog == null) {
|
if (dialog == null) {
|
||||||
dialog = new JDialog(UiUtil.getActiveWindow(), DECOMPOSE_CASE_LABEL);
|
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
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
if (TYPE_KEYS[0].equals(decompositionType.getSelectedItem()) && !productEqualsToNumberOfSubdomain()) {
|
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
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
status = Status.CANCEL;
|
status = Status.CANCEL;
|
||||||
|
|
@ -183,25 +244,19 @@ public class DecomposeCasePanel extends JPanel {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
|
JPanel buttonsPanel = createButtonsPanel(saveAndCloseDialogAction, cancelAction);
|
||||||
|
|
||||||
JButton okButton = new JButton(saveAndCloseDialogAction);
|
JScrollPane pane = new JScrollPane(this);
|
||||||
okButton.setName("OK");
|
pane.setBorder(BorderFactory.createEmptyBorder());
|
||||||
buttonsPanel.add(okButton);
|
|
||||||
|
|
||||||
JButton cancelButton = new JButton(cancelAction);
|
|
||||||
cancelButton.setName("Cancel");
|
|
||||||
buttonsPanel.add(cancelButton);
|
|
||||||
|
|
||||||
JPanel mainPanel = new JPanel(new BorderLayout());
|
JPanel mainPanel = new JPanel(new BorderLayout());
|
||||||
mainPanel.add(this, BorderLayout.CENTER);
|
mainPanel.add(pane, BorderLayout.CENTER);
|
||||||
mainPanel.add(buttonsPanel, BorderLayout.SOUTH);
|
mainPanel.add(buttonsPanel, BorderLayout.SOUTH);
|
||||||
|
|
||||||
dialog.add(mainPanel);
|
dialog.add(mainPanel);
|
||||||
dialog.setSize(350, 200);
|
dialog.setSize(400, 300);
|
||||||
dialog.setLocationRelativeTo(null);
|
dialog.setLocationRelativeTo(null);
|
||||||
dialog.setModal(true);
|
dialog.setModal(true);
|
||||||
dialog.getRootPane().setDefaultButton(okButton);
|
|
||||||
|
|
||||||
dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
|
dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
|
||||||
dialog.addWindowListener(new WindowAdapter() {
|
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() {
|
private boolean productEqualsToNumberOfSubdomain() {
|
||||||
int nOfSubdomains = nProcessorsField.getIntValue();
|
int nOfSubdomains = nProcessorsField.getIntValue();
|
||||||
int x = nHierarchyField[X].getIntValue();
|
int x = nHierarchyField[X].getIntValue();
|
||||||
|
|
@ -1,28 +1,27 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
package eu.engys.core.controller.actions;
|
package eu.engys.core.controller.actions;
|
||||||
|
|
||||||
import eu.engys.core.controller.Controller;
|
import eu.engys.core.controller.Controller;
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,27 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
package eu.engys.core.controller.actions;
|
package eu.engys.core.controller.actions;
|
||||||
|
|
||||||
import static eu.engys.core.project.openFOAMProject.LOG;
|
import static eu.engys.core.project.openFOAMProject.LOG;
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,27 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
package eu.engys.core.controller.actions;
|
package eu.engys.core.controller.actions;
|
||||||
|
|
||||||
import eu.engys.core.project.geometry.Surface;
|
import eu.engys.core.project.geometry.Surface;
|
||||||
|
|
@ -32,4 +31,6 @@ public interface NamingConvention {
|
||||||
String getPatchName(Surface surface);
|
String getPatchName(Surface surface);
|
||||||
|
|
||||||
String getCellZoneName(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 o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
package eu.engys.core.controller.actions;
|
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 java.io.File;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import eu.engys.core.controller.Command;
|
import eu.engys.core.controller.Command;
|
||||||
import eu.engys.core.controller.Controller;
|
import eu.engys.core.controller.Controller;
|
||||||
import eu.engys.core.controller.ScriptFactory;
|
import eu.engys.core.controller.ScriptFactory;
|
||||||
import eu.engys.core.dictionary.DictionaryUtils;
|
|
||||||
import eu.engys.core.executor.ExecutorHook;
|
import eu.engys.core.executor.ExecutorHook;
|
||||||
import eu.engys.core.executor.ExecutorMonitor;
|
import eu.engys.core.executor.ExecutorMonitor;
|
||||||
import eu.engys.core.project.Model;
|
import eu.engys.core.project.Model;
|
||||||
import eu.engys.core.project.SolverState;
|
import eu.engys.core.project.SolverState;
|
||||||
import eu.engys.core.project.openFOAMProject;
|
import eu.engys.core.project.openFOAMProject;
|
||||||
import eu.engys.core.project.state.ServerState;
|
import eu.engys.core.project.state.ServerState;
|
||||||
import eu.engys.core.project.system.ControlDict;
|
|
||||||
import eu.engys.util.PrefUtil;
|
|
||||||
|
|
||||||
public class RunCase extends AbstractRunCommand {
|
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 ACTION_NAME = "Run Case";
|
||||||
public static final String RUNNING_LABEL = "Running: ";
|
public static final String RUNNING_LABEL = "Running: ";
|
||||||
|
|
||||||
|
|
@ -67,7 +53,8 @@ public class RunCase extends AbstractRunCommand {
|
||||||
setupLogFolder();
|
setupLogFolder();
|
||||||
setupPostProcFolder();
|
setupPostProcFolder();
|
||||||
clearPolyMesh();
|
clearPolyMesh();
|
||||||
setStopAtVariableToEndTime();
|
|
||||||
|
new Stopper(model, executor).setStopAtVariableToEndTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupLogFolder() {
|
private void setupLogFolder() {
|
||||||
|
|
@ -87,41 +74,8 @@ public class RunCase extends AbstractRunCommand {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void stop() throws TimeoutException {
|
public void stop() throws Exception {
|
||||||
int stop_refresh_time = PrefUtil.getInt(PrefUtil.SERVER_CONNECTION_REFRESH_TIME, 1000);
|
new Stopper(model, executor).stop();
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected class StartHook implements ExecutorHook {
|
protected class StartHook implements ExecutorHook {
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,27 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
package eu.engys.core.controller.actions;
|
package eu.engys.core.controller.actions;
|
||||||
|
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
|
|
@ -40,9 +39,9 @@ public interface RunCommand {
|
||||||
|
|
||||||
public void executeServer(Server server) throws CommandException;
|
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();
|
public void kill();
|
||||||
|
|
||||||
|
|
@ -52,4 +51,5 @@ public interface RunCommand {
|
||||||
|
|
||||||
public boolean isRunning();
|
public boolean isRunning();
|
||||||
|
|
||||||
|
public String getJobID();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,27 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
package eu.engys.core.controller.actions;
|
package eu.engys.core.controller.actions;
|
||||||
|
|
||||||
import static eu.engys.core.project.openFOAMProject.LOG;
|
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";
|
public static final String LOG_NAME = "snappyHexMesh.log";
|
||||||
|
|
||||||
protected final ScriptFactory scriptFactory;
|
protected final ScriptFactory scriptFactory;
|
||||||
|
protected File logFile;
|
||||||
|
|
||||||
public RunMesh(Model model, Controller controller, ScriptFactory scriptFactory) {
|
public RunMesh(Model model, Controller controller, ScriptFactory scriptFactory) {
|
||||||
super(model, controller);
|
super(model, controller);
|
||||||
|
|
@ -50,7 +50,8 @@ public class RunMesh extends AbstractRunCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void beforeExecute() {
|
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();
|
clearPolyMesh();
|
||||||
setupLogFolder();
|
setupLogFolder();
|
||||||
fixDecomposeParDict(model);
|
fixDecomposeParDict(model);
|
||||||
|
|
|
||||||
|
|
@ -1,50 +1,55 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
package eu.engys.core.controller.actions;
|
package eu.engys.core.controller.actions;
|
||||||
|
|
||||||
import static eu.engys.core.OpenFOAMEnvironment.getEnvironment;
|
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.io.File;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
|
|
||||||
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import eu.engys.core.controller.Controller;
|
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.controller.ScriptFactory;
|
||||||
import eu.engys.core.executor.Executor;
|
import eu.engys.core.executor.Executor;
|
||||||
import eu.engys.core.executor.ExecutorHook;
|
import eu.engys.core.executor.ExecutorHook;
|
||||||
import eu.engys.core.executor.ExecutorListener.ExecutorState;
|
import eu.engys.core.executor.ExecutorListener.ExecutorState;
|
||||||
import eu.engys.core.executor.ExecutorMonitor;
|
import eu.engys.core.executor.ExecutorMonitor;
|
||||||
import eu.engys.core.executor.ExecutorTerminal;
|
|
||||||
import eu.engys.core.executor.TerminalExecutorMonitor;
|
import eu.engys.core.executor.TerminalExecutorMonitor;
|
||||||
import eu.engys.core.project.Model;
|
import eu.engys.core.project.Model;
|
||||||
import eu.engys.core.project.openFOAMProject;
|
import eu.engys.core.project.openFOAMProject;
|
||||||
|
import eu.engys.util.Util;
|
||||||
|
|
||||||
public class StandardInitialiseFields extends InitialiseFields {
|
public class StandardInitialiseFields extends InitialiseFields {
|
||||||
|
|
||||||
|
|
@ -54,26 +59,35 @@ public class StandardInitialiseFields extends InitialiseFields {
|
||||||
super(model, controller, 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
|
@Override
|
||||||
public void executeClient() {
|
public void executeClient() {
|
||||||
logger.debug("EXECUTE IN CLIENT");
|
logger.debug("EXECUTE IN CLIENT");
|
||||||
File script = scriptFactory.getInitialiseScript(model);
|
|
||||||
File baseDir = model.getProject().getBaseDir();
|
File baseDir = model.getProject().getBaseDir();
|
||||||
File logFile = Paths.get(baseDir.getAbsolutePath(), openFOAMProject.LOG, LOG_NAME).toFile();
|
File logFile = Paths.get(baseDir.getAbsolutePath(), openFOAMProject.LOG, LOG_NAME).toFile();
|
||||||
|
|
||||||
ExecutorTerminal terminal = new TerminalExecutorMonitor(logFile);
|
|
||||||
ExecutorMonitor monitor = new ExecutorMonitor();
|
ExecutorMonitor monitor = new ExecutorMonitor();
|
||||||
ExecutorService service = Executor.newExecutor(ACTION_NAME);
|
|
||||||
monitor.addHook(ExecutorState.FINISH, new FinishHook());
|
monitor.addHook(ExecutorState.FINISH, new FinishHook());
|
||||||
|
|
||||||
this.executor = Executor.script(script).description(ACTION_NAME).inFolder(baseDir).inTerminal(terminal).withMonitors(monitor).inService(service).env(getEnvironment(model, LOG_NAME)).keepFileOnEnd();
|
ExecutorService service = Executor.newExecutor(ACTION_NAME);
|
||||||
|
|
||||||
|
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();
|
executor.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
private class FinishHook implements ExecutorHook {
|
private class FinishHook implements ExecutorHook {
|
||||||
@Override
|
@Override
|
||||||
public void run(ExecutorMonitor m) {
|
public void run(ExecutorMonitor m) {
|
||||||
controller.reopenCase(OpenOptions.CURRENT_SETTINGS);
|
controller.reopenCase(OpenMode.CURRENT_SETTINGS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,27 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
package eu.engys.core.controller.actions;
|
package eu.engys.core.controller.actions;
|
||||||
|
|
||||||
import static eu.engys.core.OpenFOAMEnvironment.getEnvironment;
|
import static eu.engys.core.OpenFOAMEnvironment.getEnvironment;
|
||||||
|
|
@ -59,19 +58,19 @@ public class StandardRunCase extends RunCase {
|
||||||
@Override
|
@Override
|
||||||
public void executeClient() {
|
public void executeClient() {
|
||||||
logger.debug("EXECUTE IN CLIENT");
|
logger.debug("EXECUTE IN CLIENT");
|
||||||
File logFile = Paths.get(model.getProject().getBaseDir().getAbsolutePath(), openFOAMProject.LOG, model.getSolverModel().getLogFile()).toFile();
|
File baseDir = model.getProject().getBaseDir();
|
||||||
TerminalExecutorMonitor terminal = new TerminalExecutorMonitor(logFile);
|
File logFile = Paths.get(baseDir.getAbsolutePath(), openFOAMProject.LOG, model.getSolverModel().getLogFile()).toFile();
|
||||||
terminal.setStopCommand(new StopOrKillCommandOS(controller));
|
|
||||||
|
|
||||||
ExecutorMonitor monitor = new ExecutorMonitor();
|
ExecutorMonitor monitor = new ExecutorMonitor();
|
||||||
monitor.addHook(ExecutorState.START, new StartHook());
|
monitor.addHook(ExecutorState.START, new StartHook());
|
||||||
monitor.addHook(ExecutorState.RUNNING, new RunningHook());
|
monitor.addHook(ExecutorState.RUNNING, new RunningHook());
|
||||||
monitor.addHook(ExecutorState.FINISH, new FinishHook());
|
|
||||||
monitor.addHook(ExecutorState.ERROR, new ErrorHook());
|
monitor.addHook(ExecutorState.ERROR, new ErrorHook());
|
||||||
|
monitor.addHook(ExecutorState.FINISH, new FinishHook());
|
||||||
|
|
||||||
ExecutorService service = Executor.newExecutor(ACTION_NAME);
|
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();
|
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();
|
executor.exec();
|
||||||
|
|
@ -91,14 +90,14 @@ public class StandardRunCase extends RunCase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected class FinishHook implements ExecutorHook {
|
private class FinishHook implements ExecutorHook {
|
||||||
@Override
|
@Override
|
||||||
public void run(ExecutorMonitor m) {
|
public void run(ExecutorMonitor m) {
|
||||||
model.getSolverModel().setServerState(new ServerState(Command.RUN_CASE, SolverState.FINISHED));
|
model.getSolverModel().setServerState(new ServerState(Command.RUN_CASE, SolverState.FINISHED));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected class ErrorHook implements ExecutorHook {
|
private class ErrorHook implements ExecutorHook {
|
||||||
@Override
|
@Override
|
||||||
public void run(ExecutorMonitor m) {
|
public void run(ExecutorMonitor m) {
|
||||||
model.getSolverModel().setServerState(new ServerState(Command.RUN_CASE, SolverState.ERROR));
|
model.getSolverModel().setServerState(new ServerState(Command.RUN_CASE, SolverState.ERROR));
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,27 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
package eu.engys.core.controller.actions;
|
package eu.engys.core.controller.actions;
|
||||||
|
|
||||||
import static eu.engys.core.OpenFOAMEnvironment.getEnvironment;
|
import static eu.engys.core.OpenFOAMEnvironment.getEnvironment;
|
||||||
|
|
@ -35,6 +34,7 @@ import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import eu.engys.core.controller.Controller;
|
import eu.engys.core.controller.Controller;
|
||||||
|
import eu.engys.core.controller.KillCommandOS;
|
||||||
import eu.engys.core.controller.ScriptFactory;
|
import eu.engys.core.controller.ScriptFactory;
|
||||||
import eu.engys.core.executor.Executor;
|
import eu.engys.core.executor.Executor;
|
||||||
import eu.engys.core.executor.ExecutorHook;
|
import eu.engys.core.executor.ExecutorHook;
|
||||||
|
|
@ -63,7 +63,10 @@ public class StandardRunMesh extends RunMesh {
|
||||||
|
|
||||||
ExecutorService service = Executor.newExecutor(ACTION_NAME);
|
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();
|
executor.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,27 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
package eu.engys.core.controller.actions;
|
package eu.engys.core.controller.actions;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
@ -34,6 +33,8 @@ public class StopCommandInfo extends CommandInfo {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(StopCommandInfo.class);
|
private static final Logger logger = LoggerFactory.getLogger(StopCommandInfo.class);
|
||||||
|
|
||||||
|
public static final String TIMEOUT = "Timeout";
|
||||||
|
|
||||||
public boolean timeout;
|
public boolean timeout;
|
||||||
|
|
||||||
public static StopCommandInfo wrap(CommandInfo info) {
|
public static StopCommandInfo wrap(CommandInfo info) {
|
||||||
|
|
@ -48,7 +49,7 @@ public class StopCommandInfo extends CommandInfo {
|
||||||
public static StopCommandInfo timeoutException(Exception e) {
|
public static StopCommandInfo timeoutException(Exception e) {
|
||||||
logger.error(">>> SERVER STOP ERROR", e);
|
logger.error(">>> SERVER STOP ERROR", e);
|
||||||
StopCommandInfo ci = new StopCommandInfo();
|
StopCommandInfo ci = new StopCommandInfo();
|
||||||
ci.message = "Timeout";
|
ci.message = TIMEOUT;
|
||||||
ci.exception = e;
|
ci.exception = e;
|
||||||
ci.success = false;
|
ci.success = false;
|
||||||
ci.timeout = true;
|
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 o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
package eu.engys.core.controller.actions;
|
package eu.engys.core.controller.actions;
|
||||||
|
|
||||||
public class TimeoutException extends Exception {
|
public class TimeoutException extends Exception {
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,27 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
package eu.engys.core.dictionary;
|
package eu.engys.core.dictionary;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
@ -130,7 +129,7 @@ public class BeanToDict {
|
||||||
|
|
||||||
for (Method m : methods) {
|
for (Method m : methods) {
|
||||||
String fieldName = "";
|
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);
|
fieldName = getFieldNameFromGetter(m);
|
||||||
} else if (m.getName().startsWith("is")) {
|
} else if (m.getName().startsWith("is")) {
|
||||||
fieldName = getFieldNameFromBooleanGetter(m);
|
fieldName = getFieldNameFromBooleanGetter(m);
|
||||||
|
|
@ -143,7 +142,7 @@ public class BeanToDict {
|
||||||
addToDictionary(dictionary, fieldName, value);
|
addToDictionary(dictionary, fieldName, value);
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
ex.printStackTrace();
|
logger.error("Error invoking method {}", m, ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return dictionary;
|
return dictionary;
|
||||||
|
|
@ -225,6 +224,10 @@ public class BeanToDict {
|
||||||
return dict;
|
return dict;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// public static <K, B> Map<K,B> dictToMap(Dictionary dictionary, B bean) {
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
private static String toArray(Object array) throws Exception {
|
private static String toArray(Object array) throws Exception {
|
||||||
return toBracketedArrayOfStrings(array);
|
return toBracketedArrayOfStrings(array);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,39 +1,37 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
package eu.engys.core.dictionary;
|
package eu.engys.core.dictionary;
|
||||||
|
|
||||||
import static eu.engys.core.dictionary.Dictionary.SPACER;
|
import static eu.engys.core.dictionary.Dictionary.SPACER;
|
||||||
import static eu.engys.core.dictionary.Dictionary.TAB;
|
import static eu.engys.core.dictionary.Dictionary.TAB;
|
||||||
import static eu.engys.core.dictionary.Dictionary.VERBOSE;
|
import static eu.engys.core.dictionary.Dictionary.VERBOSE;
|
||||||
|
|
||||||
import eu.engys.core.dictionary.parser.ListField2;
|
import eu.engys.core.dictionary.parser.ListField2;
|
||||||
|
|
||||||
public class BlockMeshWriter extends DictionaryWriter {
|
public class BlockMeshWriter extends DictionaryWriter {
|
||||||
|
|
||||||
|
|
||||||
public BlockMeshWriter(Dictionary dictionary) {
|
public BlockMeshWriter(Dictionary dictionary) {
|
||||||
super(dictionary);
|
super(dictionary);
|
||||||
}
|
}
|
||||||
|
|
@ -105,6 +103,7 @@ public class BlockMeshWriter extends DictionaryWriter {
|
||||||
private static void writeDimensionedScalar(StringBuffer sb, DimensionedScalar ds, String rowHeader) {
|
private static void writeDimensionedScalar(StringBuffer sb, DimensionedScalar ds, String rowHeader) {
|
||||||
if (VERBOSE)
|
if (VERBOSE)
|
||||||
System.out.println("Dictionary.writeDimensionedScalar() " + (ds != null ? ds.getName() : "NULL!!!"));
|
System.out.println("Dictionary.writeDimensionedScalar() " + (ds != null ? ds.getName() : "NULL!!!"));
|
||||||
|
if (ds != null) {
|
||||||
sb.append("\n");
|
sb.append("\n");
|
||||||
sb.append(rowHeader);
|
sb.append(rowHeader);
|
||||||
sb.append(TAB);
|
sb.append(TAB);
|
||||||
|
|
@ -118,3 +117,4 @@ public class BlockMeshWriter extends DictionaryWriter {
|
||||||
sb.append(";");
|
sb.append(";");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,32 +1,33 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
package eu.engys.core.dictionary;
|
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;
|
private String name;
|
||||||
|
|
||||||
|
|
@ -44,9 +45,18 @@ public class DefaultElement {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (obj instanceof DefaultElement) {
|
if (!(obj instanceof DefaultElement)) {
|
||||||
return ((DefaultElement) obj).name.equals(name);
|
return false;
|
||||||
}
|
}
|
||||||
return super.equals(obj);
|
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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,39 +1,42 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
package eu.engys.core.dictionary;
|
package eu.engys.core.dictionary;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.vecmath.Point3d;
|
||||||
|
|
||||||
import org.apache.commons.lang.ArrayUtils;
|
import org.apache.commons.lang.ArrayUtils;
|
||||||
|
import org.apache.commons.lang.builder.EqualsBuilder;
|
||||||
|
import org.apache.commons.lang.builder.HashCodeBuilder;
|
||||||
|
|
||||||
import eu.engys.core.dictionary.parser.ListField2;
|
import eu.engys.core.dictionary.parser.ListField2;
|
||||||
import eu.engys.core.dictionary.parser.ThetaListField2;
|
import eu.engys.core.dictionary.parser.ThetaListField2;
|
||||||
|
|
@ -51,6 +54,9 @@ public class Dictionary extends DefaultElement {
|
||||||
|
|
||||||
public static final String TYPE = "type";
|
public static final String TYPE = "type";
|
||||||
public static final String VALUE = "value";
|
public static final String VALUE = "value";
|
||||||
|
public static final String CONSTANT = "constant";
|
||||||
|
public static final String NONUNIFORM = "nonuniform";
|
||||||
|
public static final String UNIFORM = "uniform";
|
||||||
|
|
||||||
private FoamFile foamFile;
|
private FoamFile foamFile;
|
||||||
|
|
||||||
|
|
@ -68,7 +74,6 @@ public class Dictionary extends DefaultElement {
|
||||||
this(file.getName(), file);
|
this(file.getName(), file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Dictionary(String name, InputStream input, DictionaryLinkResolver resolver) {
|
public Dictionary(String name, InputStream input, DictionaryLinkResolver resolver) {
|
||||||
super(name);
|
super(name);
|
||||||
readDictionary(input, resolver);
|
readDictionary(input, resolver);
|
||||||
|
|
@ -179,10 +184,33 @@ public class Dictionary extends DefaultElement {
|
||||||
put(name, new FieldElement(name, value));
|
put(name, new FieldElement(name, value));
|
||||||
}
|
}
|
||||||
|
|
||||||
// public void add(Finder finder, String value) {
|
public void add(String name, Boolean value) {
|
||||||
// String key = findKey(finder);
|
put(name, new FieldElement(name, String.valueOf(value)));
|
||||||
// put(key, new FieldElement(key, value));
|
}
|
||||||
// }
|
|
||||||
|
public void add(String name, Double value) {
|
||||||
|
put(name, new FieldElement(name, String.valueOf(value)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add(String name, Integer value) {
|
||||||
|
put(name, new FieldElement(name, String.valueOf(value)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addUniform(String name, Double value) {
|
||||||
|
put(name, new FieldElement(name, UNIFORM + " " + String.valueOf(value)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addUniform(String name, Integer value) {
|
||||||
|
put(name, new FieldElement(name, UNIFORM + " " + String.valueOf(value)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addConstant(String name, Double value) {
|
||||||
|
put(name, new FieldElement(name, CONSTANT + " " + String.valueOf(value)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addConstant(String name, Integer value) {
|
||||||
|
put(name, new FieldElement(name, CONSTANT + " " + String.valueOf(value)));
|
||||||
|
}
|
||||||
|
|
||||||
public void addGeneric(String name, String value) {
|
public void addGeneric(String name, String value) {
|
||||||
if (!genericKeys.contains(name)) {
|
if (!genericKeys.contains(name)) {
|
||||||
|
|
@ -191,15 +219,55 @@ public class Dictionary extends DefaultElement {
|
||||||
put(name, new FieldElement(name, value));
|
put(name, new FieldElement(name, value));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void add(String name, double[] values) {
|
public void addUniform(String name, double[] values) {
|
||||||
StringBuffer sb = new StringBuffer("(");
|
StringBuffer sb = new StringBuffer(UNIFORM + " ( ");
|
||||||
for (double d : values) {
|
for (Double d : values) {
|
||||||
sb.append(String.valueOf(d) + " ");
|
sb.append(String.valueOf(d) + " ");
|
||||||
}
|
}
|
||||||
sb.append(")");
|
sb.append(")");
|
||||||
this.add(name, sb.toString());
|
this.add(name, sb.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String toString(double[] values) {
|
||||||
|
StringBuffer sb = new StringBuffer("( ");
|
||||||
|
for (Double d : values) {
|
||||||
|
sb.append(String.valueOf(d) + " ");
|
||||||
|
}
|
||||||
|
sb.append(")");
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String toString(double[][] values) {
|
||||||
|
StringBuffer sb = new StringBuffer("( ");
|
||||||
|
for (int i = 0; i < values.length; i++) {
|
||||||
|
sb.append(toString(values[i]) + " ");
|
||||||
|
}
|
||||||
|
sb.append(")");
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add(String name, double[] values) {
|
||||||
|
this.add(name, toString(values));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add(String name, double[][] values) {
|
||||||
|
this.add(name, toString(values));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add(String name, String[][] values) {
|
||||||
|
StringBuffer sb = new StringBuffer("( ");
|
||||||
|
for (int i = 0; i < values.length; i++) {
|
||||||
|
sb.append("( ");
|
||||||
|
for (int j = 0; j < values[i].length; j++) {
|
||||||
|
String d = values[i][j];
|
||||||
|
sb.append(d + " ");
|
||||||
|
}
|
||||||
|
sb.append(") ");
|
||||||
|
}
|
||||||
|
sb.append(")");
|
||||||
|
this.add(name, sb.toString());
|
||||||
|
}
|
||||||
|
|
||||||
public void add(String name, int[] values) {
|
public void add(String name, int[] values) {
|
||||||
StringBuffer sb = new StringBuffer("( ");
|
StringBuffer sb = new StringBuffer("( ");
|
||||||
for (int d : values) {
|
for (int d : values) {
|
||||||
|
|
@ -238,7 +306,7 @@ public class Dictionary extends DefaultElement {
|
||||||
put(list.getName(), list);
|
put(list.getName(), list);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String findKey(Finder finder) {
|
public String findKey(Finder finder) {
|
||||||
for (String key : keys) {
|
for (String key : keys) {
|
||||||
if (finder.accept(key)) {
|
if (finder.accept(key)) {
|
||||||
return key;
|
return key;
|
||||||
|
|
@ -289,6 +357,11 @@ public class Dictionary extends DefaultElement {
|
||||||
return (el != null && el instanceof Dictionary);
|
return (el != null && el instanceof Dictionary);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isScalar(String name) {
|
||||||
|
DefaultElement el = getElement(name);
|
||||||
|
return (el != null && el instanceof DimensionedScalar);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isField(String name) {
|
public boolean isField(String name) {
|
||||||
DefaultElement el = getElement(name);
|
DefaultElement el = getElement(name);
|
||||||
return (el != null && el instanceof FieldElement);
|
return (el != null && el instanceof FieldElement);
|
||||||
|
|
@ -383,6 +456,15 @@ public class Dictionary extends DefaultElement {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean lookupBoolean(String name) {
|
||||||
|
String value = lookupString(name);
|
||||||
|
if (value != null) {
|
||||||
|
return value.equalsIgnoreCase("true") || value.equalsIgnoreCase("yes") || value.equalsIgnoreCase("on");
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public int lookupInt(String name) {
|
public int lookupInt(String name) {
|
||||||
String value = lookupString(name);
|
String value = lookupString(name);
|
||||||
try {
|
try {
|
||||||
|
|
@ -392,6 +474,15 @@ public class Dictionary extends DefaultElement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int lookupIntConstant(String name) {
|
||||||
|
String value = lookupString(name).replace(CONSTANT, "").trim();
|
||||||
|
try {
|
||||||
|
return Integer.parseInt(value);
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public double lookupDouble(String name) {
|
public double lookupDouble(String name) {
|
||||||
String value = lookupString(name);
|
String value = lookupString(name);
|
||||||
try {
|
try {
|
||||||
|
|
@ -401,6 +492,24 @@ public class Dictionary extends DefaultElement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double lookupDoubleUniform(String name) {
|
||||||
|
String value = lookupString(name).replace(UNIFORM, "").trim();
|
||||||
|
try {
|
||||||
|
return Double.parseDouble(value);
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
return Double.NaN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public double lookupDoubleConstant(String name) {
|
||||||
|
String value = lookupString(name).replace(CONSTANT, "").trim();
|
||||||
|
try {
|
||||||
|
return Double.parseDouble(value);
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
return Double.NaN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public DimensionedScalar lookupScalar(String name) {
|
public DimensionedScalar lookupScalar(String name) {
|
||||||
DefaultElement el = getElement(name);
|
DefaultElement el = getElement(name);
|
||||||
if (el != null && el instanceof DimensionedScalar) {
|
if (el != null && el instanceof DimensionedScalar) {
|
||||||
|
|
@ -411,16 +520,7 @@ public class Dictionary extends DefaultElement {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] lookupArray(String name) {
|
public static String[] toArray(String value) {
|
||||||
DefaultElement el = getElement(name);
|
|
||||||
if (el != null && el instanceof FieldElement) {
|
|
||||||
String value = ((FieldElement) el).getValue();
|
|
||||||
if (value.startsWith("uniform")) {
|
|
||||||
value = value.replace("uniform", "").trim();
|
|
||||||
}
|
|
||||||
if (value.startsWith("nonuniform")) {
|
|
||||||
return new String[] { "Infinity", "Infinity", "Infinity" };
|
|
||||||
}
|
|
||||||
if (value.startsWith("(") && value.endsWith(")")) {
|
if (value.startsWith("(") && value.endsWith(")")) {
|
||||||
value = value.replace("(", "").replace(")", "").trim();
|
value = value.replace("(", "").replace(")", "").trim();
|
||||||
// value = value.substring(1, value.length()-1);
|
// value = value.substring(1, value.length()-1);
|
||||||
|
|
@ -431,24 +531,45 @@ public class Dictionary extends DefaultElement {
|
||||||
// System.out.println("Dictionary.lookupArray() "+Arrays.toString(values));
|
// System.out.println("Dictionary.lookupArray() "+Arrays.toString(values));
|
||||||
return values;
|
return values;
|
||||||
} else
|
} else
|
||||||
throw new DictionaryException(name + " not an array");
|
throw new DictionaryException("'" + value + "' not an array");
|
||||||
} else if (el != null)
|
}
|
||||||
throw new DictionaryException(name + " not a field");
|
|
||||||
else
|
public String[] lookupArray(String name) {
|
||||||
|
DefaultElement el = getElement(name);
|
||||||
|
if (el != null && el instanceof FieldElement) {
|
||||||
|
String value = ((FieldElement) el).getValue();
|
||||||
|
if (value.startsWith(UNIFORM)) {
|
||||||
|
value = value.replace(UNIFORM, "").trim();
|
||||||
|
}
|
||||||
|
if (value.startsWith(NONUNIFORM)) {
|
||||||
|
return new String[] { "Infinity", "Infinity", "Infinity" };
|
||||||
|
}
|
||||||
|
|
||||||
|
return toArray(value);
|
||||||
|
|
||||||
|
} else if (el != null) {
|
||||||
|
throw new DictionaryException(name + " not a field [ " + el.getClass() + "]");
|
||||||
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public String[][] lookupMatrix(String name) {
|
public String[][] lookupMatrix(String name) {
|
||||||
DefaultElement el = getElement(name);
|
DefaultElement el = getElement(name);
|
||||||
if (el != null && el instanceof FieldElement) {
|
if (el != null && el instanceof FieldElement) {
|
||||||
String value = ((FieldElement) el).getValue();
|
String value = ((FieldElement) el).getValue();
|
||||||
if (value.startsWith("uniform")) {
|
if (value.startsWith(UNIFORM)) {
|
||||||
value = value.replace("uniform", "").trim();
|
value = value.replace(UNIFORM, "").trim();
|
||||||
}
|
}
|
||||||
if (value.startsWith("(") && value.endsWith(")")) {
|
if (value.startsWith("(") && value.endsWith(")")) {
|
||||||
value = value.replaceAll("\\(\\s*\\(", "");
|
value = value.replaceAll("\\(\\s*\\(", "");
|
||||||
value = value.replaceAll("\\)\\s*\\)", "");
|
value = value.replaceAll("\\)\\s*\\)", "");
|
||||||
|
|
||||||
|
// is empty matrix
|
||||||
|
if (value.trim().matches("\\(\\s*\\)")) {
|
||||||
|
return new String[0][0];
|
||||||
|
}
|
||||||
|
|
||||||
String[] values = value.split("\\)\\s*\\(");
|
String[] values = value.split("\\)\\s*\\(");
|
||||||
String[][] matrix = new String[values.length][];
|
String[][] matrix = new String[values.length][];
|
||||||
for (int r = 0; r < values.length; r++) {
|
for (int r = 0; r < values.length; r++) {
|
||||||
|
|
@ -527,8 +648,7 @@ public class Dictionary extends DefaultElement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public double[] lookupDoubleArray(String name) {
|
public static double[] toDouble(String[] array) {
|
||||||
String[] array = lookupArray(name);
|
|
||||||
double[] doubleArray = new double[array.length];
|
double[] doubleArray = new double[array.length];
|
||||||
for (int i = 0; i < doubleArray.length; i++) {
|
for (int i = 0; i < doubleArray.length; i++) {
|
||||||
try {
|
try {
|
||||||
|
|
@ -539,6 +659,35 @@ public class Dictionary extends DefaultElement {
|
||||||
return doubleArray;
|
return doubleArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double[] lookupDoubleArray(String key) {
|
||||||
|
String[] array = lookupArray(key);
|
||||||
|
double[] doubleArray = new double[array.length];
|
||||||
|
for (int i = 0; i < doubleArray.length; i++) {
|
||||||
|
try {
|
||||||
|
doubleArray[i] = Double.valueOf(array[i]);
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return doubleArray;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double[] lookupDoubleArray(Finder finder) {
|
||||||
|
String key = findKey(finder);
|
||||||
|
if (key != null) {
|
||||||
|
String[] array = lookupArray(key);
|
||||||
|
double[] doubleArray = new double[array.length];
|
||||||
|
for (int i = 0; i < doubleArray.length; i++) {
|
||||||
|
try {
|
||||||
|
doubleArray[i] = Double.valueOf(array[i]);
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return doubleArray;
|
||||||
|
} else {
|
||||||
|
throw new DictionaryException(key + " not a field");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public double[] lookupDoubleArray2(String name) {
|
public double[] lookupDoubleArray2(String name) {
|
||||||
String[] array = lookupArray2(name);
|
String[] array = lookupArray2(name);
|
||||||
double[] doubleArray = new double[array.length];
|
double[] doubleArray = new double[array.length];
|
||||||
|
|
@ -553,7 +702,7 @@ public class Dictionary extends DefaultElement {
|
||||||
|
|
||||||
public double[][] lookupDoubleMatrix(String name) {
|
public double[][] lookupDoubleMatrix(String name) {
|
||||||
String[][] matrix = lookupMatrix(name);
|
String[][] matrix = lookupMatrix(name);
|
||||||
double[][] doubleMatrix = new double[matrix.length][matrix[0].length];
|
double[][] doubleMatrix = new double[matrix.length][matrix.length == 0 ? 0 : matrix[0].length];
|
||||||
for (int i = 0; i < doubleMatrix.length; i++) {
|
for (int i = 0; i < doubleMatrix.length; i++) {
|
||||||
for (int j = 0; j < doubleMatrix[i].length; j++) {
|
for (int j = 0; j < doubleMatrix[i].length; j++) {
|
||||||
try {
|
try {
|
||||||
|
|
@ -565,6 +714,19 @@ public class Dictionary extends DefaultElement {
|
||||||
return doubleMatrix;
|
return doubleMatrix;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Point3d> lookupPointList(String name) {
|
||||||
|
double[][] matrix = lookupDoubleMatrix(name);
|
||||||
|
List<Point3d> doubleMatrixList = new LinkedList<>();
|
||||||
|
for (double[] ds : matrix) {
|
||||||
|
if (ds.length == 3) {
|
||||||
|
doubleMatrixList.add(new Point3d(ds[0], ds[1], ds[2]));
|
||||||
|
} else {
|
||||||
|
doubleMatrixList.add(new Point3d());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return doubleMatrixList;
|
||||||
|
}
|
||||||
|
|
||||||
public double[][] lookupDoubleMatrix2(String name) {
|
public double[][] lookupDoubleMatrix2(String name) {
|
||||||
String[][] matrix = lookupMatrix2(name);
|
String[][] matrix = lookupMatrix2(name);
|
||||||
double[][] doubleMatrix = new double[matrix.length][matrix[0].length];
|
double[][] doubleMatrix = new double[matrix.length][matrix[0].length];
|
||||||
|
|
@ -611,7 +773,7 @@ public class Dictionary extends DefaultElement {
|
||||||
return genericKeys;
|
return genericKeys;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> getKeys() {
|
public List<String> getKeys() {
|
||||||
return keys;
|
return keys;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -760,21 +922,6 @@ public class Dictionary extends DefaultElement {
|
||||||
keys.clear();
|
keys.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
if (obj instanceof Dictionary) {
|
|
||||||
Dictionary d = (Dictionary) obj;
|
|
||||||
if (elements.size() != d.elements.size())
|
|
||||||
return false;
|
|
||||||
for (String key : elements.keySet()) {
|
|
||||||
if (!elements.get(key).equals(d.elements.get(key)))
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* * * * * * * * * * * * *
|
/* * * * * * * * * * * * *
|
||||||
* READ/WRITE STUFF * * * * * * * * * * * *
|
* READ/WRITE STUFF * * * * * * * * * * * *
|
||||||
*/
|
*/
|
||||||
|
|
@ -804,4 +951,21 @@ public class Dictionary extends DefaultElement {
|
||||||
return writer.write();
|
return writer.write();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (!(obj instanceof Dictionary)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (obj == this) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
Dictionary dict = (Dictionary) obj;
|
||||||
|
return new EqualsBuilder().appendSuper(super.equals(obj)).append(elements, dict.elements).isEquals();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return new HashCodeBuilder(17, 31).appendSuper(super.hashCode()).append(elements).toHashCode();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,27 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
package eu.engys.core.dictionary;
|
package eu.engys.core.dictionary;
|
||||||
|
|
||||||
|
|
@ -46,6 +45,36 @@ public class DictionaryBuilder {
|
||||||
return this;
|
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) {
|
public DictionaryBuilder dimensionedScalar(String k, String v, String d) {
|
||||||
dictionary.add(new DimensionedScalar(k, v, d));
|
dictionary.add(new DimensionedScalar(k, v, d));
|
||||||
return this;
|
return this;
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,27 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
package eu.engys.core.dictionary;
|
package eu.engys.core.dictionary;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,27 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
package eu.engys.core.dictionary;
|
package eu.engys.core.dictionary;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,27 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
package eu.engys.core.dictionary;
|
package eu.engys.core.dictionary;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,27 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
package eu.engys.core.dictionary;
|
package eu.engys.core.dictionary;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,37 +1,46 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
package eu.engys.core.dictionary;
|
package eu.engys.core.dictionary;
|
||||||
|
|
||||||
import static eu.engys.core.dictionary.Dictionary.SPACER;
|
import static eu.engys.core.dictionary.Dictionary.SPACER;
|
||||||
import static eu.engys.core.dictionary.Dictionary.TAB;
|
import static eu.engys.core.dictionary.Dictionary.TAB;
|
||||||
import static eu.engys.core.dictionary.Dictionary.VERBOSE;
|
import static eu.engys.core.dictionary.Dictionary.VERBOSE;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import eu.engys.core.dictionary.parser.ListField2;
|
import eu.engys.core.dictionary.parser.ListField2;
|
||||||
|
|
||||||
public class DictionaryWriter {
|
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;
|
protected Dictionary dictionary;
|
||||||
|
|
||||||
protected final String START = "{";
|
protected final String START = "{";
|
||||||
|
|
@ -87,7 +96,7 @@ public class DictionaryWriter {
|
||||||
if (ele != null) {
|
if (ele != null) {
|
||||||
writeElement(sb, rowHeader, ele);
|
writeElement(sb, rowHeader, ele);
|
||||||
} else {
|
} 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()) {
|
for (String includeFile : dictionary.getIncludeFiles()) {
|
||||||
|
|
@ -99,7 +108,9 @@ public class DictionaryWriter {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void writeElement(StringBuffer sb, String rowHeader, DefaultElement ele) {
|
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);
|
DictionaryWriter writer = new DictionaryWriter((Dictionary) ele);
|
||||||
writer.writeDictionary(sb, rowHeader + TAB);
|
writer.writeDictionary(sb, rowHeader + TAB);
|
||||||
} else if (ele instanceof DimensionedScalar) {
|
} else if (ele instanceof DimensionedScalar) {
|
||||||
|
|
@ -120,7 +131,7 @@ public class DictionaryWriter {
|
||||||
private static boolean hasParenthesis(DefaultElement ele) {
|
private static boolean hasParenthesis(DefaultElement ele) {
|
||||||
FieldElement fieldElement = (FieldElement) ele;
|
FieldElement fieldElement = (FieldElement) ele;
|
||||||
String value = fieldElement.getValue();
|
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) {
|
protected static void writeField(StringBuffer sb, FieldElement field, String rowHeader) {
|
||||||
|
|
@ -146,9 +157,9 @@ public class DictionaryWriter {
|
||||||
sb.append(SPACER);
|
sb.append(SPACER);
|
||||||
String value = field.getValue();
|
String value = field.getValue();
|
||||||
if (value.contains("vector")) {
|
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 {
|
} 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(";");
|
sb.append(";");
|
||||||
}
|
}
|
||||||
|
|
@ -167,6 +178,7 @@ public class DictionaryWriter {
|
||||||
private static void writeDimensionedScalar(StringBuffer sb, DimensionedScalar ds, String rowHeader) {
|
private static void writeDimensionedScalar(StringBuffer sb, DimensionedScalar ds, String rowHeader) {
|
||||||
if (VERBOSE)
|
if (VERBOSE)
|
||||||
System.out.println("Dictionary.writeDimensionedScalar() " + (ds != null ? ds.getName() : "NULL!!!"));
|
System.out.println("Dictionary.writeDimensionedScalar() " + (ds != null ? ds.getName() : "NULL!!!"));
|
||||||
|
if (ds != null) {
|
||||||
sb.append("\n");
|
sb.append("\n");
|
||||||
sb.append(rowHeader);
|
sb.append(rowHeader);
|
||||||
sb.append(TAB);
|
sb.append(TAB);
|
||||||
|
|
@ -180,3 +192,4 @@ public class DictionaryWriter {
|
||||||
sb.append(";");
|
sb.append(";");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,27 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
package eu.engys.core.dictionary;
|
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,31 +1,32 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
package eu.engys.core.dictionary;
|
package eu.engys.core.dictionary;
|
||||||
|
|
||||||
|
import org.apache.commons.lang.builder.EqualsBuilder;
|
||||||
|
import org.apache.commons.lang.builder.HashCodeBuilder;
|
||||||
|
|
||||||
public class FieldElement extends DefaultElement {
|
public class FieldElement extends DefaultElement {
|
||||||
|
|
||||||
private String value;
|
private String value;
|
||||||
|
|
@ -54,9 +55,25 @@ public class FieldElement extends DefaultElement {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (obj instanceof FieldElement) {
|
if (!(obj instanceof FieldElement)) {
|
||||||
return ((FieldElement) obj).getName().equals(getName()) && ((FieldElement) obj).value.equals(value) ;
|
|
||||||
}
|
|
||||||
return false;
|
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 o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
package eu.engys.core.dictionary;
|
package eu.engys.core.dictionary;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,27 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
package eu.engys.core.dictionary;
|
package eu.engys.core.dictionary;
|
||||||
|
|
||||||
public interface Finder {
|
public interface Finder {
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,27 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
package eu.engys.core.dictionary;
|
package eu.engys.core.dictionary;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,27 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
package eu.engys.core.dictionary;
|
package eu.engys.core.dictionary;
|
||||||
|
|
||||||
|
|
@ -185,4 +184,14 @@ public class ListField extends DefaultElement {
|
||||||
return null;
|
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 o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
package eu.engys.core.dictionary;
|
package eu.engys.core.dictionary;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,27 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
package eu.engys.core.dictionary;
|
package eu.engys.core.dictionary;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,27 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
package eu.engys.core.dictionary;
|
package eu.engys.core.dictionary;
|
||||||
|
|
||||||
public class StartWithFinder implements Finder {
|
public class StartWithFinder implements Finder {
|
||||||
|
|
|
||||||
|
|
@ -1,32 +1,35 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
package eu.engys.core.dictionary;
|
package eu.engys.core.dictionary;
|
||||||
|
|
||||||
import static eu.engys.core.dictionary.Dictionary.SPACER;
|
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;
|
import eu.engys.core.dictionary.parser.ListField2;
|
||||||
|
|
||||||
public class TableRowElement extends DefaultElement {
|
public class TableRowElement extends DefaultElement {
|
||||||
|
|
@ -73,28 +76,30 @@ public class TableRowElement extends DefaultElement {
|
||||||
return values;
|
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) {
|
public void merge(TableRowElement el) {
|
||||||
this.values = el.values;
|
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 o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
package eu.engys.core.dictionary.model;
|
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.BorderLayout;
|
||||||
import java.awt.FlowLayout;
|
import java.awt.FlowLayout;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
|
|
@ -87,11 +89,11 @@ public abstract class AbstractTableAdapter extends JPanel {
|
||||||
buttonsPanel.setOpaque(false);
|
buttonsPanel.setOpaque(false);
|
||||||
|
|
||||||
JButton addButton = new JButton(new AddRowAction());
|
JButton addButton = new JButton(new AddRowAction());
|
||||||
addButton.setName("add.row.button");
|
addButton.setName(ADD_ROW_BUTTON_NAME);
|
||||||
buttonsPanel.add(addButton);
|
buttonsPanel.add(addButton);
|
||||||
|
|
||||||
JButton remButton = new JButton(new RemRowAction());
|
JButton remButton = new JButton(new RemRowAction());
|
||||||
remButton.setName("rem.row.button");
|
remButton.setName(REM_ROW_BUTTON_NAME);
|
||||||
buttonsPanel.add(remButton);
|
buttonsPanel.add(remButton);
|
||||||
return buttonsPanel;
|
return buttonsPanel;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,27 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
package eu.engys.core.dictionary.model;
|
package eu.engys.core.dictionary.model;
|
||||||
|
|
||||||
import eu.engys.util.ui.textfields.DoubleField;
|
import eu.engys.util.ui.textfields.DoubleField;
|
||||||
|
|
@ -33,24 +32,54 @@ public class AxisInfo {
|
||||||
public static final String LABEL = "Point ";
|
public static final String LABEL = "Point ";
|
||||||
private DoubleField[] center;
|
private DoubleField[] center;
|
||||||
private EventActionType action;
|
private EventActionType action;
|
||||||
|
private double magnitude;
|
||||||
|
private DoubleField toe;
|
||||||
|
private DoubleField camber;
|
||||||
private DoubleField[] axis;
|
private DoubleField[] axis;
|
||||||
|
private int sign;
|
||||||
|
|
||||||
public AxisInfo(DoubleField[] axis, DoubleField[] center, EventActionType action) {
|
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 AxisInfo(DoubleField[] axis, DoubleField[] center, int magnitude, EventActionType action) {
|
||||||
this.axis = axis;
|
this.axis = axis;
|
||||||
this.center = center;
|
this.center = center;
|
||||||
|
this.magnitude = magnitude;
|
||||||
this.action = action;
|
this.action = action;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DoubleField[] getAxis() {
|
public DoubleField getToe() {
|
||||||
return axis;
|
return toe;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DoubleField getCamber() {
|
||||||
|
return camber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getSign() {
|
||||||
|
return sign;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DoubleField[] getCenter() {
|
public DoubleField[] getCenter() {
|
||||||
return center;
|
return center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DoubleField[] getAxis() {
|
||||||
|
return axis;
|
||||||
|
}
|
||||||
|
|
||||||
public EventActionType getAction() {
|
public EventActionType getAction() {
|
||||||
return action;
|
return action;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double getMagnitude() {
|
||||||
|
return magnitude;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,28 +1,27 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
package eu.engys.core.dictionary.model;
|
package eu.engys.core.dictionary.model;
|
||||||
|
|
||||||
import static eu.engys.util.ui.ComponentsFactory.checkBoxControllerField;
|
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.spinnerField;
|
||||||
import static eu.engys.util.ui.ComponentsFactory.stringField;
|
import static eu.engys.util.ui.ComponentsFactory.stringField;
|
||||||
|
|
||||||
|
import java.awt.BorderLayout;
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
|
|
@ -54,7 +54,9 @@ import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
|
|
||||||
import javax.swing.JCheckBox;
|
import javax.swing.JCheckBox;
|
||||||
import javax.swing.JComboBox;
|
import javax.swing.JComboBox;
|
||||||
|
import javax.swing.JComponent;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
|
import javax.swing.ListModel;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
@ -62,10 +64,10 @@ import org.slf4j.LoggerFactory;
|
||||||
import eu.engys.core.dictionary.Dictionary;
|
import eu.engys.core.dictionary.Dictionary;
|
||||||
import eu.engys.core.dictionary.DictionaryUtils;
|
import eu.engys.core.dictionary.DictionaryUtils;
|
||||||
import eu.engys.core.dictionary.DimensionedScalar;
|
import eu.engys.core.dictionary.DimensionedScalar;
|
||||||
import eu.engys.core.dictionary.FieldChangeListener;
|
|
||||||
import eu.engys.core.project.zero.patches.Patches;
|
import eu.engys.core.project.zero.patches.Patches;
|
||||||
import eu.engys.util.filechooser.util.SelectionMode;
|
import eu.engys.util.filechooser.util.SelectionMode;
|
||||||
import eu.engys.util.ui.ComponentsFactory;
|
import eu.engys.util.ui.ComponentsFactory;
|
||||||
|
import eu.engys.util.ui.FieldChangeListener;
|
||||||
import eu.engys.util.ui.FileFieldPanel;
|
import eu.engys.util.ui.FileFieldPanel;
|
||||||
import eu.engys.util.ui.ListBuilder;
|
import eu.engys.util.ui.ListBuilder;
|
||||||
import eu.engys.util.ui.ListFieldPanel;
|
import eu.engys.util.ui.ListFieldPanel;
|
||||||
|
|
@ -91,8 +93,8 @@ public class DictionaryModel {
|
||||||
public void dictionaryChanged() throws DictionaryError;
|
public void dictionaryChanged() throws DictionaryError;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<DictionaryListener> listeners = new CopyOnWriteArrayList<DictionaryModel.DictionaryListener>();
|
private List<DictionaryListener> listeners = new CopyOnWriteArrayList<>();
|
||||||
private Map<String, DictionaryModel> subModels = new HashMap<String, DictionaryModel>();
|
private Map<String, DictionaryModel> subModels = new HashMap<>();
|
||||||
|
|
||||||
public static class DictionaryError extends Exception {
|
public static class DictionaryError extends Exception {
|
||||||
private String[] messages;
|
private String[] messages;
|
||||||
|
|
@ -222,26 +224,34 @@ public class DictionaryModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
public JCheckBox bindBoolean(String key) {
|
public JCheckBox bindBoolean(String key) {
|
||||||
JCheckBox field = checkField();
|
return bindBoolean(key, false);
|
||||||
field.addActionListener(new BooleanFieldHandler(key, field, false));
|
|
||||||
return field;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public JCheckBox bindBoolean(String key, boolean def) {
|
public JCheckBox bindBoolean(String key, boolean def) {
|
||||||
|
return bindBoolean(key, def, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public JCheckBox bindBoolean(String key, boolean def, boolean fireEvent) {
|
||||||
JCheckBox field = checkField(def);
|
JCheckBox field = checkField(def);
|
||||||
field.addActionListener(new BooleanFieldHandler(key, field, def));
|
field.addActionListener(new BooleanFieldHandler(key, field, def, fireEvent));
|
||||||
return field;
|
return field;
|
||||||
}
|
}
|
||||||
|
|
||||||
public JCheckBox bindBoolean(String key, String trueValue, String falseValue) {
|
public JCheckBox bindBoolean(String key, String trueValue, String falseValue) {
|
||||||
JCheckBox field = checkField();
|
JCheckBox field = checkField();
|
||||||
field.addActionListener(new BooleanValuesFieldHandler(key, field, trueValue, falseValue));
|
field.addActionListener(new BooleanValuesFieldHandler(key, field, trueValue, falseValue, false));
|
||||||
return field;
|
return field;
|
||||||
}
|
}
|
||||||
|
|
||||||
public JCheckBox bindBoolean(String key, String trueValue, String falseValue, boolean def) {
|
public JCheckBox bindBoolean(String key, String trueValue, String falseValue, boolean def) {
|
||||||
JCheckBox field = checkField(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;
|
return field;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -291,7 +301,6 @@ public class DictionaryModel {
|
||||||
|
|
||||||
// public IntegerField bindInteger(String key, String name) {
|
// public IntegerField bindInteger(String key, String name) {
|
||||||
// IntegerField field = bindInteger(key);
|
// IntegerField field = bindInteger(key);
|
||||||
// field.setName(name);
|
|
||||||
// return field;
|
// return field;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
@ -334,7 +343,6 @@ public class DictionaryModel {
|
||||||
|
|
||||||
// public DoubleField bindUniformDoubleWithName(String key, String name) {
|
// public DoubleField bindUniformDoubleWithName(String key, String name) {
|
||||||
// DoubleField field = doubleField();
|
// DoubleField field = doubleField();
|
||||||
// field.setName(name);
|
|
||||||
// field.addPropertyChangeListener(new DoubleUniformFieldHandler(key,
|
// field.addPropertyChangeListener(new DoubleUniformFieldHandler(key,
|
||||||
// field));
|
// field));
|
||||||
// return field;
|
// return field;
|
||||||
|
|
@ -377,6 +385,13 @@ public class DictionaryModel {
|
||||||
return field;
|
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) {
|
public DoubleField bindDouble(String key) {
|
||||||
return bindDouble(key, (FieldChangeListener) null);
|
return bindDouble(key, (FieldChangeListener) null);
|
||||||
}
|
}
|
||||||
|
|
@ -393,6 +408,42 @@ public class DictionaryModel {
|
||||||
return field;
|
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) {
|
public DoubleField bindDouble(String key, Double def) {
|
||||||
DoubleField field = doubleField(def);
|
DoubleField field = doubleField(def);
|
||||||
field.addPropertyChangeListener(new DoubleFieldHandler(key, field, null));
|
field.addPropertyChangeListener(new DoubleFieldHandler(key, field, null));
|
||||||
|
|
@ -435,7 +486,6 @@ public class DictionaryModel {
|
||||||
DoubleField[] field = doublePointField();
|
DoubleField[] field = doublePointField();
|
||||||
for (int i = 0; i < field.length; i++) {
|
for (int i = 0; i < field.length; i++) {
|
||||||
DoubleField f = field[i];
|
DoubleField f = field[i];
|
||||||
f.setName(key + "." + i);
|
|
||||||
f.addPropertyChangeListener(new PointFieldHandler(key, field, listener));
|
f.addPropertyChangeListener(new PointFieldHandler(key, field, listener));
|
||||||
}
|
}
|
||||||
return field;
|
return field;
|
||||||
|
|
@ -445,12 +495,21 @@ public class DictionaryModel {
|
||||||
DoubleField[] field = doublePointField(places);
|
DoubleField[] field = doublePointField(places);
|
||||||
for (int i = 0; i < field.length; i++) {
|
for (int i = 0; i < field.length; i++) {
|
||||||
DoubleField f = field[i];
|
DoubleField f = field[i];
|
||||||
f.setName(key + "." + i);
|
|
||||||
f.addPropertyChangeListener(new PointFieldHandler(key, field, listener));
|
f.addPropertyChangeListener(new PointFieldHandler(key, field, listener));
|
||||||
}
|
}
|
||||||
return field;
|
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) {
|
public DoubleField[] bindPoint(String key) {
|
||||||
return bindPoint(key, null);
|
return bindPoint(key, null);
|
||||||
}
|
}
|
||||||
|
|
@ -479,16 +538,6 @@ public class DictionaryModel {
|
||||||
return field;
|
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) {
|
public DoubleField[] bindUniformPoint(String key1, String key2) {
|
||||||
DoubleField[] field = doublePointField();
|
DoubleField[] field = doublePointField();
|
||||||
for (int i = 0; i < field.length; i++) {
|
for (int i = 0; i < field.length; i++) {
|
||||||
|
|
@ -513,7 +562,6 @@ public class DictionaryModel {
|
||||||
for (int i = 0; i < field.length; i++) {
|
for (int i = 0; i < field.length; i++) {
|
||||||
DoubleField f = field[i];
|
DoubleField f = field[i];
|
||||||
f.setColumns(1);
|
f.setColumns(1);
|
||||||
f.setName(key + "." + i);
|
|
||||||
f.addPropertyChangeListener(new PointFieldHandler(key, field, null));
|
f.addPropertyChangeListener(new PointFieldHandler(key, field, null));
|
||||||
}
|
}
|
||||||
return field;
|
return field;
|
||||||
|
|
@ -543,6 +591,12 @@ public class DictionaryModel {
|
||||||
return combo;
|
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) {
|
public JComboBox<String> bindSelection(String key, String... keys) {
|
||||||
JComboBox<String> combo = selectField(keys, keys);
|
JComboBox<String> combo = selectField(keys, keys);
|
||||||
combo.addActionListener(new SelectFieldHandler(key, combo, null));
|
combo.addActionListener(new SelectFieldHandler(key, combo, null));
|
||||||
|
|
@ -567,7 +621,7 @@ public class DictionaryModel {
|
||||||
|
|
||||||
public JCheckBoxController bindCheckBoxController(String key, String name) {
|
public JCheckBoxController bindCheckBoxController(String key, String name) {
|
||||||
JCheckBoxController combo = checkBoxControllerField(name);
|
JCheckBoxController combo = checkBoxControllerField(name);
|
||||||
combo.addActionListener(new BooleanFieldHandler(key, combo, false));
|
combo.addActionListener(new BooleanFieldHandler(key, combo, false, true));
|
||||||
return combo;
|
return combo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -767,19 +821,15 @@ public class DictionaryModel {
|
||||||
|
|
||||||
class SpinnerFieldHandler implements PropertyChangeListener, DictionaryListener {
|
class SpinnerFieldHandler implements PropertyChangeListener, DictionaryListener {
|
||||||
public SpinnerFieldHandler(String key, SpinnerField field) {
|
public SpinnerFieldHandler(String key, SpinnerField field) {
|
||||||
// TODO Auto-generated constructor stub
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dictionaryChanged() throws DictionaryError {
|
public void dictionaryChanged() throws DictionaryError {
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void propertyChange(PropertyChangeEvent evt) {
|
public void propertyChange(PropertyChangeEvent evt) {
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -899,7 +949,7 @@ public class DictionaryModel {
|
||||||
dictionary.add(key, sb.toString());
|
dictionary.add(key, sb.toString());
|
||||||
logger.trace("PointFieldHandler -> value: {}", dictionary.lookup(key));
|
logger.trace("PointFieldHandler -> value: {}", dictionary.lookup(key));
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
listener.fieldChanged();
|
listener.fieldChanged(evt.getSource());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -949,7 +999,7 @@ public class DictionaryModel {
|
||||||
dictionary.add(key, Double.toString(field.getDoubleValue()));
|
dictionary.add(key, Double.toString(field.getDoubleValue()));
|
||||||
logger.trace("DoubleFieldHandler -> value: {}", dictionary.lookup(key));
|
logger.trace("DoubleFieldHandler -> value: {}", dictionary.lookup(key));
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
listener.fieldChanged();
|
listener.fieldChanged(evt.getSource());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -986,7 +1036,7 @@ public class DictionaryModel {
|
||||||
public void propertyChange(PropertyChangeEvent evt) {
|
public void propertyChange(PropertyChangeEvent evt) {
|
||||||
if (evt.getPropertyName().equals("value")) {
|
if (evt.getPropertyName().equals("value")) {
|
||||||
if (!Double.isInfinite(field.getDoubleValue())) {
|
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));
|
logger.trace("DoubleUniformFieldHandler -> value: {}", dictionary.lookup(key));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1022,7 +1072,7 @@ public class DictionaryModel {
|
||||||
@Override
|
@Override
|
||||||
public void propertyChange(PropertyChangeEvent evt) {
|
public void propertyChange(PropertyChangeEvent evt) {
|
||||||
if (evt.getPropertyName().equals("value")) {
|
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());
|
logger.trace("DoubleUniformFieldHandler -> " + dictionary.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1053,7 +1103,7 @@ public class DictionaryModel {
|
||||||
@Override
|
@Override
|
||||||
public void propertyChange(PropertyChangeEvent evt) {
|
public void propertyChange(PropertyChangeEvent evt) {
|
||||||
if (evt.getPropertyName().equals("value")) {
|
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());
|
logger.trace("DoubleUniformFieldHandler -> " + dictionary.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1084,7 +1134,7 @@ public class DictionaryModel {
|
||||||
@Override
|
@Override
|
||||||
public void propertyChange(PropertyChangeEvent evt) {
|
public void propertyChange(PropertyChangeEvent evt) {
|
||||||
if (evt.getPropertyName().equals("value")) {
|
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));
|
logger.trace("DoubleUniformFieldHandler -> value: {}", dictionary.lookup(key));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1107,11 +1157,13 @@ public class DictionaryModel {
|
||||||
private JCheckBox check;
|
private JCheckBox check;
|
||||||
private String key;
|
private String key;
|
||||||
private final boolean def;
|
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.check = check;
|
||||||
this.key = key;
|
this.key = key;
|
||||||
this.def = def;
|
this.def = def;
|
||||||
|
this.fireEvent = fireEvent;
|
||||||
DictionaryModel.this.addDictionaryListener(this);
|
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;
|
String correctedForYesNo = value == null ? String.valueOf(def) : value.equals("yes") ? "true" : value.equals("no") ? "false" : value;
|
||||||
boolean b = Boolean.parseBoolean(correctedForYesNo);
|
boolean b = Boolean.parseBoolean(correctedForYesNo);
|
||||||
if (b != check.isSelected()) {
|
if (b != check.isSelected()) {
|
||||||
|
if(fireEvent){
|
||||||
check.doClick();
|
check.doClick();
|
||||||
|
}
|
||||||
check.setSelected(b);
|
check.setSelected(b);
|
||||||
}
|
}
|
||||||
logger.trace("BooleanFieldHandler -> value: {}", value);
|
logger.trace("BooleanFieldHandler -> value: {}", value);
|
||||||
|
|
@ -1141,12 +1195,14 @@ public class DictionaryModel {
|
||||||
private String key;
|
private String key;
|
||||||
private final String trueValue;
|
private final String trueValue;
|
||||||
private final String falseValue;
|
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.check = check;
|
||||||
this.key = key;
|
this.key = key;
|
||||||
this.trueValue = trueValue;
|
this.trueValue = trueValue;
|
||||||
this.falseValue = falseValue;
|
this.falseValue = falseValue;
|
||||||
|
this.lightEvent = lightEvent;
|
||||||
DictionaryModel.this.addDictionaryListener(this);
|
DictionaryModel.this.addDictionaryListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1162,8 +1218,12 @@ public class DictionaryModel {
|
||||||
String value = dictionary.lookup(key);
|
String value = dictionary.lookup(key);
|
||||||
boolean selected = value != null && value.equals(trueValue);
|
boolean selected = value != null && value.equals(trueValue);
|
||||||
if (shouldClick(selected, check.isSelected())) {
|
if (shouldClick(selected, check.isSelected())) {
|
||||||
|
if(lightEvent){
|
||||||
|
check.setSelected(!check.isSelected());
|
||||||
|
} else {
|
||||||
check.doClick();
|
check.doClick();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
logger.trace("BooleanValuesFieldHandler -> value: {}", value);
|
logger.trace("BooleanValuesFieldHandler -> value: {}", value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1235,8 +1295,7 @@ public class DictionaryModel {
|
||||||
sb.append("( ");
|
sb.append("( ");
|
||||||
for (int i = 0; i < field.length; i++) {
|
for (int i = 0; i < field.length; i++) {
|
||||||
if (field[i].getValue() != null) {
|
if (field[i].getValue() != null) {
|
||||||
sb.append(field[i].getDoubleValue());
|
sb.append(field[i].getDoubleValue() + " ");
|
||||||
sb.append(" ");
|
|
||||||
} else {
|
} else {
|
||||||
sb.append("0 ");
|
sb.append("0 ");
|
||||||
}
|
}
|
||||||
|
|
@ -1245,7 +1304,7 @@ public class DictionaryModel {
|
||||||
dictionary.add(key, sb.toString());
|
dictionary.add(key, sb.toString());
|
||||||
logger.trace("PointFieldHandler -> value: {}", dictionary.lookup(key));
|
logger.trace("PointFieldHandler -> value: {}", dictionary.lookup(key));
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
listener.fieldChanged();
|
listener.fieldChanged(evt.getSource());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1292,14 +1351,7 @@ public class DictionaryModel {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
StringBuilder sb = new StringBuilder();
|
dictionary.addUniform(key, DoubleField.toArray(field));
|
||||||
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());
|
|
||||||
logger.trace("PointFieldHandler -> value: {}", dictionary.lookup(key));
|
logger.trace("PointFieldHandler -> value: {}", dictionary.lookup(key));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,27 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
package eu.engys.core.dictionary.model;
|
package eu.engys.core.dictionary.model;
|
||||||
|
|
||||||
import static eu.engys.core.dictionary.Dictionary.TYPE;
|
import static eu.engys.core.dictionary.Dictionary.TYPE;
|
||||||
|
|
@ -85,9 +84,13 @@ public class DictionaryPanelBuilder extends PanelBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void selectDictionaries(Dictionary newDictionary, Dictionary newCompanion) {
|
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 newName = newDictionary.getName();
|
||||||
String newType = newDictionary.lookup(TYPE);
|
String newType = newDictionary.lookup(selector);
|
||||||
String newCompanionType = newCompanion.lookup(TYPE);
|
String newCompanionType = newCompanion.lookup(selector);
|
||||||
// System.out.println("ChoicePanelBuilder.selectDictionary() NEW TYPE: "+newType+" NEW NAME: "+newName+" NEW COMPANION TYPE: "+newCompanionType);
|
// System.out.println("ChoicePanelBuilder.selectDictionary() NEW TYPE: "+newType+" NEW NAME: "+newName+" NEW COMPANION TYPE: "+newCompanionType);
|
||||||
// System.out.println("-------------------");
|
// System.out.println("-------------------");
|
||||||
for (String key : modelsByKey.keySet()) {
|
for (String key : modelsByKey.keySet()) {
|
||||||
|
|
@ -96,8 +99,8 @@ public class DictionaryPanelBuilder extends PanelBuilder {
|
||||||
if (model.getCompanions().size() > 0) {
|
if (model.getCompanions().size() > 0) {
|
||||||
Dictionary oldCompanion = model.getCompanions().get(0).getDictionary();
|
Dictionary oldCompanion = model.getCompanions().get(0).getDictionary();
|
||||||
String oldName = oldDictionary.getName();
|
String oldName = oldDictionary.getName();
|
||||||
String oldType = oldDictionary.lookup(TYPE);
|
String oldType = oldDictionary.lookup(selector);
|
||||||
String oldCompanionType = oldCompanion.lookup(TYPE);
|
String oldCompanionType = oldCompanion.lookup(selector);
|
||||||
// System.out.println("DictionaryPanelBuilder.selectDictionaries() OLD TYPE: "+oldType+" OLD NAME: "+oldName+" OLD COMPANION TYPE: "+oldCompanionType);
|
// 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)) {
|
if (newName.equals(oldName) && newType.equals(oldType) && newCompanionType.equals(oldCompanionType)) {
|
||||||
|
|
@ -117,9 +120,13 @@ public class DictionaryPanelBuilder extends PanelBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void selectDictionary(Dictionary newDictionary) {
|
public void selectDictionary(Dictionary newDictionary) {
|
||||||
|
selectDictionary(newDictionary, TYPE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void selectDictionary(Dictionary newDictionary, String selector) {
|
||||||
if (newDictionary != null /* && newDictionary.found(TYPE) */) {
|
if (newDictionary != null /* && newDictionary.found(TYPE) */) {
|
||||||
String newName = newDictionary.getName();
|
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);
|
// System.out.println("DictionaryPanelBuilder.selectDictionary() NEW TYPE: "+newType+" NEW NAME: "+newName);
|
||||||
if (newName != null && newType != null) {
|
if (newName != null && newType != null) {
|
||||||
|
|
@ -128,7 +135,7 @@ public class DictionaryPanelBuilder extends PanelBuilder {
|
||||||
if (model.getCompanions().size() == 0) {
|
if (model.getCompanions().size() == 0) {
|
||||||
Dictionary oldDictionary = model.getDictionary();
|
Dictionary oldDictionary = model.getDictionary();
|
||||||
String oldName = oldDictionary.getName();
|
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);
|
// System.out.println("DictionaryPanelBuilder.selectDictionary() OLD TYPE: "+oldType+" OLD NAME: "+oldName);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,27 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
package eu.engys.core.dictionary.model;
|
package eu.engys.core.dictionary.model;
|
||||||
|
|
||||||
import eu.engys.core.dictionary.model.DictionaryModel.DictionaryListener;
|
import eu.engys.core.dictionary.model.DictionaryModel.DictionaryListener;
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,27 @@
|
||||||
/*--------------------------------*- Java -*---------------------------------*\
|
/*******************************************************************************
|
||||||
| o |
|
* | o |
|
||||||
| o o | HelyxOS: The Open Source GUI for OpenFOAM |
|
* | o o | HELYX-OS: The Open Source GUI for OpenFOAM |
|
||||||
| o O o | Copyright (C) 2012-2016 ENGYS |
|
* | o O o | Copyright (C) 2012-2016 ENGYS |
|
||||||
| o o | http://www.engys.com |
|
* | o o | http://www.engys.com |
|
||||||
| o | |
|
* | o | |
|
||||||
|---------------------------------------------------------------------------|
|
* |---------------------------------------------------------------------------|
|
||||||
| License |
|
* | License |
|
||||||
| This file is part of HelyxOS. |
|
* | This file is part of HELYX-OS. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is free software; you can redistribute it and/or modify it |
|
* | 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 |
|
* | 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 |
|
* | Free Software Foundation; either version 2 of the License, or (at your |
|
||||||
| option) any later version. |
|
* | option) any later version. |
|
||||||
| |
|
* | |
|
||||||
| HelyxOS is distributed in the hope that it will be useful, but WITHOUT |
|
* | HELYX-OS is distributed in the hope that it will be useful, but WITHOUT |
|
||||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
* | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||||
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
* | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
||||||
| for more details. |
|
* | for more details. |
|
||||||
| |
|
* | |
|
||||||
| You should have received a copy of the GNU General Public License |
|
* | You should have received a copy of the GNU General Public License |
|
||||||
| along with HelyxOS; if not, write to the Free Software Foundation, |
|
* | along with HELYX-OS; if not, write to the Free Software Foundation, |
|
||||||
| Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
* | Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
||||||
\*---------------------------------------------------------------------------*/
|
*******************************************************************************/
|
||||||
|
|
||||||
package eu.engys.core.dictionary.model;
|
package eu.engys.core.dictionary.model;
|
||||||
|
|
||||||
public enum EventActionType {
|
public enum EventActionType {
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue