Tuukka Lehtonen [Wed, 10 Jun 2020 18:43:29 +0000 (21:43 +0300)]
Fixed bug in cluster collection logic that caused it to not operate
In case the first encountered resident cluster happened to be large
enough to cover the requested cluster collection size, the code would
collect no clusters at all.
Also contains improvements to dynamic cluster collection.
Tuukka Lehtonen [Thu, 4 Jun 2020 22:33:16 +0000 (01:33 +0300)]
Avoid useless reallocation of empty TreeMaps and map iterators
The problem was that when the database is doing work, MainProgram.run
runs in pretty much busy loop mode and previously it was always
allocating a new TreeMap on each round and also calling Map.entrySet()
to get construct iterators for empty TreeMaps which eventually
accumulates up to somewhat signinificant amount of memory allocated.
Possibly an even more efficient way would be to have the Map be a closed
hashing hashmap instead and then sorting the data for iteration
separately.
Tuukka Lehtonen [Fri, 3 Jan 2020 11:51:33 +0000 (13:51 +0200)]
Added new field TypeId to dependency index for exact type searching
The new field is String-valued and contains a concatenation of the
resource ids of a resource's type hierarchy, separated by a whitespace,
for example `41233 12423 1233`. This field uses the WhitespaceAnalyzer,
i.e. its contents are tokenized by whitespace and thus searches like
`TypeId:41233` will return exactly those resources that are instances of
the type resource `41233`.
This commit also simplifies and fixes some of the existing index
searching code to use this new field instead of the old `Types` field
for type-based searching.
If existing product-code uses the indexing facilities directly and not
through `QueryIndexUtils` or `Instances`, such code will also require
changes to take this new field into use.
See `IndexQueries` to form queries related to this field.
Tuukka Lehtonen [Tue, 18 Dec 2018 14:37:39 +0000 (16:37 +0200)]
Optimized Layer0Utils.getPossibleDefaultBinding
Removed badly named datatype_binging public static field from
Layer0Utils in favor of Bindings.DATATYPE. If you were using the
previous Layer0Utils constant in some place, just replace it.
The problem in the optimized code was that it was constantly converting
SCL types like "Double", "Boolean" etc. to databoard datatypes using the
databoard type parser even though those basic primitive types should
have been already premapped somewhere to prevent the need for any kind
of parsing.
Previously nodes could only return null to say "I have no bounds".
Now it is possible to return GeometryUtils.undefinedBounds() to say
"ignore my bounds" to G2DParentNode.
Also allow customization of the node class used by ElementPainter to
mark selections under "element nodes" through a new configuration class
ElementPainterConfiguration.
This allows e.g. district to use its own node for this purpose to
optimize the scene graph and customize the bounds it returns.
Tuukka Lehtonen [Mon, 4 Nov 2019 14:12:08 +0000 (16:12 +0200)]
Removed trailing newline from clipboard text
When copying text to clipboard from GraphExplorer-based UI controls
(Model Browser, Selection view) using StandardCopyHandler, the produced
text no longer contains a trailing newline.
jsimomaa [Thu, 31 Oct 2019 07:27:35 +0000 (09:27 +0200)]
Fix adding components to configurationBySolverName map in MappingBase
The map is now invalidated (= null) when components are added which
means the map will be recalculated next time when retrieved with
getConfigurationBySolverName.
Tuukka Lehtonen [Tue, 29 Oct 2019 14:42:11 +0000 (16:42 +0200)]
Support reading TG files with shared and non-shared value contexts
This is part of the fix for a nasty corner case in
TransferableGraphFileReader.readTG's deserialization of referable value
data types.
This regression was caused by commit bf495713dbc9dec325f3929889466fa6cd58b541 over 1.5 years ago. The removal
of idContext.clear() was done without proper understanding of the real
issue.
The real issue is that TG's are currently written in two ways by
different codes: with shared and with non-shared value contexts.
Serializing TransferableGraph1 structures using the default Binding will
use shared context for serializing the values Variant array. Thus all TG
files produced by the graph compiler use a shared value context which
eans this class must be used with sharedValueContext set to true. As an
example, <code>true</code> must be used if the corresponding TG file is
written e.g. like this:
DataContainers.writeFile(location
new DataContainer(format,
version,
metadata,
new Variant(TransferableGraph1.BINDING, tg)));
On the other hand, any TG files serialized using more optimized methods
like ModelTransferableGraphSource do not use a shared value context when
writing the file. This means those files cannot be read safely using
standard {@link Binding} at all, and when using this class,
sharedValueContext must be set to false to prevent the import from
corrupting datatype values because the referable parts of datatypes may
get bound to the wrong existing types if the data is read using shared
context.
After this change clients should use readTG(File | InputStream, boolean)
methods instead of readTG to always specify the context sharing setting
explicitly according to how the TG's in question were written.
Tuukka Lehtonen [Thu, 17 Oct 2019 07:52:39 +0000 (10:52 +0300)]
Rid TypicalPropertyTester of database read transactions
After this, the normal workbench invocations of TypicalPropertyTester no
longer perform any database transactions to do their work. DiagramViewer
now has built-in support for doing the required queries based on
IDiagram hints alone.
Added two new user component SCL script simulation stages
1. pre-step: executed during each simulation step,
before native simulation stepping
2. post-step: executed during each simulation step,
after native and all other stepping logics
The purpose of these is to allow simulation step initialization and
finalization with UC SCL scripts.
Allow simulation stop handling in Simantics/Sequences
`StopReason` enumerates supported reasons for simulation stops which is
delivered once to functions registered through `executeWhenStopped`.
It is up to the domain-specific sequence runners to implement the actual
identification of simulation stopping situations and to invoke
AbstractActionContext.stop(StopReason reason) when needed.
Tuukka Lehtonen [Wed, 12 Dec 2018 21:03:41 +0000 (23:03 +0200)]
Fixed target platform problem with missing net.jcip.annotations
It seems that updating eclipse.collections caused
net.jcip.annotations dependency to be removed which meant
the bundle is no longer in the external dependencies P2 site.
* @Optional annotation added duplicate annotations to BindingRequest for
certain classes
* @Identifier annotation was not actually removed from the
BindingRequest
* BindingRequest hashCode calculation used annotation args excluding the
ones possibly found from the clazz.getAnnotations()
* Prevent replacing existing bindings in BindingRepository.classMap
* Remove excessive use of explicit Types/Names constants in search
queries by using public static fields from Dependencies
* Added missing quoting to terms in index searches
* Use DependencyResources function where the Map returned by
Dependencies is not needed
* Fixed some searches to be case-insensitive again
Jussi Koskela [Fri, 26 Apr 2019 08:31:36 +0000 (11:31 +0300)]
Index tokenized lowercase versions of name and types for UI searches
* Added support for different name/label in search parameter selection.
* Fixed resource search to form wildcard query separately for each term.
* Added utility methods to SearchQuery for lower/uppercasing the query
Tuukka Lehtonen [Fri, 9 Nov 2018 12:04:08 +0000 (14:04 +0200)]
Still fixes history collection value band endTime setting and rendering
Previous changes set value band end time to be the same as the next
value band's start time. However this caused the problem that there is
no way of telling during rendering where exactly within the previous
value band did the band's value go out of dead band and since t_end does
not tell us this. This means that line-rendering (not stepped sample
rendering) will get drawn invalidly if t_end > t_begin within a value
band.
The fix was to set t_end to the last timestamp where the value was still
within deadband, i.e:
```
|t0 t0_end | VALUE BAND #0 t0 < t0_end
| | |t1 | VALUE BAND #1 t1 = t1_end
| | |t1_end |
| | | |t2... VALUE BAND #2
ts0----ts1---- ts2------ts3---
v=0 v=0 v=1 v=2
```
* Moved recordFieldNames from SCLConstructor to SCLValue and renamed as
parameterNames
* Replaced String array fieldNames in SCLConstructor and Constructor by
more generic ComponentAcces array and renamed as componentAccesses.
Performance and resource consumption optimization for G2D picking
* Scene graph R-tree based spatial optimization of picked
IElement-material resolution
* Parallel processing for both resolving the elements to pick and
picking the elements
* Added INode -> IElement map management to ElementPainter to have the
fastest possible means available in picking for getting from scene
graph nodes to their corresponding IElement instances.
jsimomaa [Fri, 30 Nov 2018 12:04:34 +0000 (14:04 +0200)]
Speeding up platform startup time
Shaved ~1.5seconds off by starting SCL compiler priming at the beginning
of platform startup on the background before the LifeCycleProcesses
project feature needs the compiler.
Also removed seemingly unused VirtualGraphInitializer that installed
virtualgraphs/*.tg files into random memory-persistent virtual graphs
during platform startup. It simply piles on some startup overhead and
does nothing.