Java Scientific Containers (JSciC) is an open-source Java library providing a generic data type for scientific datasets, primarily for visualization systems applications. A generic concept of the field represents the dataset with three components – structure, geometry, and values – allowing to represent the majority of numerical data used in the scientific environment. Not only regular and irregular (unstructured) grids with implicit or explicit geometry are supported, but also multiple numeric data components (multivariate fields) with scalar or vector elements. Flexible time support is provided by independent time steps. Additional functionality, including interpolation, slicing, and statistics, is also available in the library. Parallel execution arithmetic on data components is incorporated with full physical units support. JSciC library serves as a base for generic data representation in the VisNow platform.
State-of-the-art of a generic approach to data types in visualization applications is the format of VTK library. However, from a technical perspective, VTK is a C/C++ library, and even though it has multiple wrappers or derived libraries for different programming languages, including Java, there is no popular native Java alternative. VTK includes a complete set of visualization functions, while JSciC focuses only on scientific data containers.
JSciC is our proposition of pure-Java implementation of a generic data type applicable for visualization purposes supporting large data structures. From a technical perspective, due to Java object memory management, JSciC follows an assumption of storing numerical and indexation data in flat (one dimensional) arrays as an alternative to storing object hierarchy (e.g. field → cell-set → cell → wall → edge → cell → wall → edge → node). As Java lacks true multidimensional arrays, most numerical libraries in Java use a similar approach to store multidimensional data. However, to overcome Java limitation of 231 elements in a single array (the equivalent of a 3D regular grid of 12903 scalar elements) JSciC uses JLargeArrays library to store native memory arrays up to 263 elements. From a substantial perspective, JSciC follows an assumption that to represent data in a generic manner it is required to define the generic field object and to provide three elements of the description – geometry, structure, and values.
Generic field concept
- The geometry part of the field object describes the spatial location of nodes, the structure part defines relationships between nodes, forming a data grid, and the values represent measurements on each given node.
- Three subtypes of the field: regular, irregular, and point.
- Nodes in a regular field are organized as 1, 2, or 3-dimensional regular grid.
- The geometry of a regular field can be determined either by its origin and unit cell vectors (affine field) or by explicitly given coordinate array.
- An irregular field is determined by a set of nodes and one or more cell sets. JSciC supports point, segment, triangle, quadrangle, tetrahedron, pyramid, prism, and hexahedron as basic cell types. In addition to node data, cell data can be defined with different data on each cell set.
- Multivariate values, called components, can be defined over nodes or cells.
- Multiple components can be defined in one field.
- Supported types of components: logic, byte, short, int, long, float, double, complex, String, Object.
- Physical units and linear mapping to the physical range are supported.
- Each data component can be scalar or vector.
- Field nodes can be masked as valid or invalid.
Time dependency is defined for geometry, mask and data components (structure dependency is under development). The key concept of time in JSciC is to treat time independently for each variable (component), mask and geometry, thus multiple different time steps can be defined for each of them. Additionally the library provides proper interpolation functionality for any time moment.
- JSciC library provides multiple embedded structure, geometry and data processing tools as field’s functionality or generic utilities:
- I/O operations (header + data),
- Data components functionality include:
- type conversion,
- arithmetic operations with physical units,
- linear algebra.
- Built-in parallelization on multicore architectures.
Applications and Visualization Context
As JSciC library originated from the VisNow environment, it was designed to serve the functionality required for the generic visualization system. Currently, it provides the basic internal data structures for the VisNow modular visualization system. All functionalities of JSciC library find its representation in VisNow system at a higher layer and with a proper user interface. Detailed information on the field and the components may be presented in the description window.
Both regular and irregular fields, serving as the structure and geometry, provide primitives and basic structures for visualization purposes (e.g. 3D cells) and represent the generic fields in regular and irregular grids.
Multivariate field data – multiple components – provide a choice of data for colormapping or other visual layer representation of a single field. For example, a multivariate 3D field can be represented with volume rendering technique, where three data components are mapped to RGB colors and one component is mapped as transparency. Data arithmetic at component level provided by JSciC is utilized as component calculator with expression parser within VisNow module, serving as data generator or calculator for derived components. VisNow Field data format (VNF) being a native file format for data fields is a direct usage of JSciC provided I/O.
JSciC can be useful in applications that require generic data types defined in a real vector space such as physical simulations and engineering tools. Provided I/O functionality may be utilized in simulation codes, where real time visualization can be obtained without conversion of data formats. Finally, JSciC can be used in all Java applications that process very large datasets common in microscopic, medical and cosmological sciences.