Commit Graph

90 Commits

Author SHA1 Message Date
Kenneth Moreland
2af555f6c9 Simplify serialization of DataSet objects
`vtkm::cont::DataSet` is a dynamic object that can hold cell sets and
fields of many different types, none of which are known until runtime. This
causes a problem with serialization, which has to know what type to compile
the serialization for, particularly when unserializing the type at the
receiving end. The original implementation "solved" the problem by creating
a secondary wrapper object that was templated on types of field arrays and
cell sets that might be serialized. This is not a great solution as it
punts the problem to algorithm developers.

This problem has been completely solved for fields, as it is possible to
serialize most types of arrays without knowing their type now. You still
need to iterate over every possible `CellSet` type, but there are not that
many `CellSet`s that are practically encountered. Thus, there is now a
direct implementation of `Serialization` for `DataSet` that covers all the
data types you are likely to encounter.

The old `SerializableDataSet` has been deprecated. In the unlikely event an
algorithm needs to transfer a non-standard type of `CellSet` (such as a
permuted cell set), it can use the replacement `DataSetWithCellSetTypes`,
which just specifies the cell set types.
2023-03-03 09:17:44 -07:00
Kenneth Moreland
c0e0032e1d Clarify field index ordering in Doxygen
The fields in a `DataSet` are indexed from `0` to `GetNumberOfFields() - 1`.
It is natural to assume that the fields will be indexed in the order that
they are added, but they are not. Rather, the indexing is arbitrary and can
change any time a field is added to the dataset.

To make this more clear, Doxygen documentation is added to the `DataSet`
methods to inform users to not make any assumptions about the order of
field indexing.
2023-01-10 10:42:49 -07:00
Kenneth Moreland
4ca64f0f09 Back out of DataSet::CopyPartsFromExcept method
This method is too unwieldy. Instead go back to `CopyStructure` and
other direct copy methods.
2022-11-11 07:53:20 -07:00
Kenneth Moreland
2d30e6d45a Coordinate systems are stored as Fields
Previously, `DataSet` managed `CoordinateSystem`s separately from `Field`s.
However, a `CoordinateSystem` is really just a `Field` with some special
attributes. Thus, coordiante systems are now just listed along with the
rest of the fields, and the coordinate systems are simply strings that
point back to the appropriate field. (This was actually the original
concept for `DataSet`, but the coordinate systems were separated from
fields for some now obsolete reasons.)
2022-11-11 06:17:58 -07:00
Kenneth Moreland
a58c2cdacf Change how cell ghost levels are set
The name of the methods were changed from `AddGhostCellField` to
`SetGhostCellField` since only one field can be marked as the cell
ghost. Also automatically select a field that matches
`GetGlobalCellFieldName` if nothing else is set.
2022-11-09 08:40:37 -07:00
Kenneth Moreland
63702d5d13 Check to make sure that the fields in a DataSet are the proper length
It is possible in a `DataSet` to add a point field (or coordinate system)
that has a different number of points than reported in the cell set.
Likewise for the number of cells in cell fields. This is very bad practice
because it is likely to lead to crashes in worklets that are expecting
arrays of an appropriate length.

Although `DataSet` will still allow this, a warning will be added to the
VTK-m logging to alert users of the inconsistency introduced into the
`DataSet`. Since warnings are by default printed to standard error, users
are likely to see it.
2022-11-01 12:05:59 -06:00
Mathieu Westphal
70ba476bd5 Fix doxygen groups 2022-09-09 10:37:31 +08:00
Dave Pugmire
a215ac3202 Use {} initialization of FieldCollection. 2022-08-29 16:53:17 -04:00
Dave Pugmire
f69e598225 Change of Field::Association names. 2022-08-29 06:40:42 -04:00
Dave Pugmire
def0f0989c Remove FieldCompare struct. 2022-08-23 07:17:16 -04:00
Dave Pugmire
714e1226ce Create FieldCollection class. 2022-08-22 15:02:03 -04:00
Tushar Athawale
aa01c51cb9 Addition of GhostCellField API to the Dataset Class
AddGhostCellField function for Dataset class

setGhostCellName function for GhostCellClassify class

setGhostCellName function for GhostCellClassify class

added default ghost cell name in Dataset class

Default ghost cell field name defined in GhostCellClassify class

Default ghost cell field name for GhostCellClassify class

Unit test for ghost field name check

Unit test for ghost field name check updated

Default ghost field name updated

Get function for GhostCellClassify and default ghost name

UnitTestStreamlineFilter updated with AddGhostCellField

AddGhostCellField and GetGlobalGhostCellFieldName propagated

GhostCellClassify constructor now defined in header file

Assigned default values to dataset class members GhostSet and GhostCellName

default values set for GhostSet and GhostCellName in dataset constructor

Constructor removed from dataset class and noexcept for GetGlobalGhostName

added Dataset constructor with noexcept

additions to make sure default move constructor has not changed

GhostSetName field made as a shared pointer since string class is not noexcept

AddGhostCellField funtion added without field name

hasGhostCellField added and unit tests updated for addGhostCellField

hasGhostCellField added and unit tests updated for addGhostCellField

GetGhostCellField and GetGhostCellFieldName functions added to Dataset

GetGhostCellField and GetGhostCellFieldName functions added to Dataset

debugging UnitTestCellLocatorGerneral for CUDA error

UnitTestCellLocatorGeneral testing for error

UnitTestCellLocatorGeneral testing for cude error

UnitTestCellLocatorGeneral error resolution

UnitTestCellLocatorGeneral error resolution

UnitTestCellLocatorGeneral error resolution print statement removed

Minor updates to Dataset class files

GlobalGhostCellFieldName implementation revised to return a static variable

GhostSet member removed, hasGhostCellField, constructor, copystructure updated

GetGhostCellField and GetGhostCellFieldName made cosistent with GetField

Fixes to a few function calls
2022-07-28 16:49:14 -04:00
Sujin Philip
796497170d DataSet::GetFieldIndex should not throw
As per its documentation, DataSet::GetFieldIndex should return -1 when
a field with the given name is not found.
2022-07-27 11:06:55 -04:00
Kenneth Moreland
f8f41e0ef5 Update use of field association enumerations
The enumerations in `vtkm::cont::Field::Association` were renamed in the
previous commit. The old names still exist, but are deprecated. Change
the rest of the code to use the new names.
2022-03-17 11:02:37 -06:00
Kenneth Moreland
5bd60a0b77 Add CreateResult to NewFilter and absorb field mapping
The original version of `Filter` classes had a helper header file named
`CreateResult.h` that had several forms of a `CreateResult` function that
helped correctly create the `DataSet` to be returned from a filter's
`DoExecute`. With the move to the `NewFilter` structure, these functions
did not line up very well with how `DataSet`s should actually be created.

A replacement for these functions have been added as protected helper
methods to `NewFilter` and `NewFilterField`. In addition to moving them
into the filter themselves, the behavior of `CreateResult` has been merged
with the map field to output functionality. The original implementation of
`Filter` did this mapping internally in a different step. The first design
of `NewFilter` required the filter implementer to call a
`MapFieldsOntoOutput` themselves. This new implementation wraps the
functionality of `CreateResult` and `MapFieldsOntoOutput` together so that
the `DataSet` will be created correctly with a single call to
`CreateResult`. This makes it easier to correctly create the output.
2022-01-27 13:27:39 -07:00
Kenneth Moreland
0a89a5fff5 Store UnknownCellSet instead of DynamicCellSet in DataSet
`UnknownCellSet` is an updated replacement for `DynamicCellSet`. The
next step in the replacement is to change `DataSet` to use the new
class.

Also replaced `DynamicCellSet` with `UnknownCellSet` in a few
places where `DynamicCellSet.h` was not directly included (and
therefore now no longer included at all). This change would have
to be made at some point anyway.
2022-01-03 13:52:30 -07:00
Kenneth Moreland
a2ab460f5d Compile more sources without device compiler
We have been doing a better job at hiding device code (and moving code
into libraries). Smoke out source that no longer needs to be compiled by
device compilers.
2022-01-03 08:23:04 -07:00
Kenneth Moreland
47371bb5e6 Add ability to convert fields to known types
In VTK-m we have a constant tension between minimizing the number of
types we have to compile for (to reduce compile times and library size)
and maximizing the number of types that our filters support.
Unfortunately, if you don't compile a filter for a specific array type
(value type and storage), trying to run that filter will simply fail.

To compromise between the two, added methods to `DataSet` and `Field`
that will automatically convert the data in the `Field` arrays to a type
that VTK-m will understand. Although this will cause an extra data copy,
it will at least prevent the program from failing, and thus make it more
feasible to reduce types.
2021-08-19 07:10:20 -06:00
Kenneth Moreland
68f39b86a8 Deprecate VariantArrayHandle
`VaraintArrayHandle` has been replaced by `UnknownArrayHandle` and
`UncertainArrayHandle`. Officially make it deprecated and point users to
the new implementations.
2021-04-07 16:12:38 -06:00
Kenneth Moreland
8b133288ce Fix deprecation warnings
There was an error that caused deprecation warnings in VTK-m to be
suppressed, which meant that many uses of deprecated features went
unnoticed. This fixes those deprecation warnings.

The majority of the warnings were caused by the use of the deprecated
`Cast`, `CopyTo`, and `ResetTypes` methods of `UnknownArrayHandle` (or
`VariantArrayHandle`). Both `Cast` and `CopyTo` have been subsumed by
`AsArrayHandle` (to make the functionality more clear). `ResetTypes` now
requires a second template argument to define the storage types to try.

Also fixed some issues with `SerializableField` being deprecated.
This class is no longer necessary because `Field` can now be directly
serialized.
2021-01-26 07:56:39 -07:00
NAThompson
fe4f71ab92 Deprecate DataSetFieldAdd. 2020-05-27 15:27:47 -04:00
Vicente Adolfo Bolea Sanchez
3b55797d41 replaces Dataset fields vector to a map
This refactor aims to increase the performance of
AddField / Getfield at the expense of memory usage and
some bits of performances when only few fields are used

Moving to non-contiguous memory will impact cpu cache benefits,
however, since each of the Field has again another pointer to
its actual data, this benefits where actually just small.

Also the choice of map v.s. unordered_map is about the number of
elements, very likely few rehashing happenings from until <100

This will also reduce the memory fragmentation caused by vectors.

Signed-off-by: Vicente Adolfo Bolea Sanchez <vicente.bolea@kitware.com>
2020-05-01 14:05:03 -04:00
Kenneth Moreland
92db376236 Convert uses of ListTagBase to List 2019-12-06 15:37:46 -07:00
Kenneth Moreland
cd302effb3 Update lists in TypeListTag.h
A new header named TypeList.h and the type lists have been redefined in
this new file. All the types have been renamed from `TypeListTag*` to
`TypeList*`. TypeListTag.h has been gutted to provide deprecated
versions of the old type list names.

There were also some other type lists that were changed from using the
old `ListTagBase` to the new `List`.
2019-12-05 11:05:19 -07:00
Robert Maynard
f2a3ecd014 Don't generate doxygen for serialization helpers 2019-09-12 17:29:05 -04:00
Robert Maynard
89fa2c0293 Remove multiple vtkm::cont::CellSet from vtkm::cont::DataSet
By removing the ability to have multiple CellSets in a DataSet
we can simplify the following things:

  - Cell Fields now don't require a CellSet name when being constructed
  - Filters don't need to manage what the active cellset is
2019-09-02 09:04:51 -04:00
Kenneth Moreland
1f8030a6e8 Add non-const version of DataSet::Get methods
A non-const version of GetCoordinateSystem was added to implement a
change to the point transform filter. To make things symmetric (and
provide likely future needs), also add non-const versions of getting the
fields and cell sets.
2019-08-26 13:58:11 -06:00
Kenneth Moreland
69226803c2 Make PointTransform actually transform the points
The primary (likely only) use of PointTransform is to perform affine
transform on the position of the mesh. However, PointTransform did not
actually move the mesh. Rather, it just created a new field with the
transformed points.

Now, the output has its coordinate system replaced with the transformed
one generated (in addition to be added as a field). This can be turned
off (but defaults to on).

Also changed the constructor to turn on UseCoordinateSystemAsField so
that by default the filter operates on the existing coordinate system
and replaces it with the new coordinate system.

Also removed the template parameter on the filter. That added an
unnecessary complication to using it.
2019-08-26 12:29:24 -06:00
Robert Maynard
b0c6e18ea7 DataSet queries for cellset and coordinate index won't trow
Queries for cellset and coordinates by name will not throw exceptions
when looking just for the index value. Instead they will return -1
2019-08-19 09:36:03 -04:00
Robert Maynard
031407443d Provide simplified way to construct point and cell fields 2019-08-15 11:03:41 -04:00
nadavi
fbcea82e78 conslidate the license statement 2019-04-17 10:57:13 -06:00
Robert Maynard
ad98d818ce VTK-m now doesn't clobber external DIY installations
Fixes #334
2019-02-05 13:05:14 -05:00
Robert Maynard
0a40c620ac Rename ArrayHandleVariant to VariantArrayHandle. 2018-12-27 14:35:56 -05:00
Robert Maynard
ef83adf3bd Field, CoordinateSystem, VirtualCoordinates all use the new virtual code 2018-12-27 14:35:56 -05:00
Robert Maynard
0da7830d9a Make sure important vtkm::cont classes have noexcept move ops.
This is important so they can be stored efficiently inside
containers such as std::vector that require strong move guarantees.
2018-12-10 10:33:18 -05:00
Sujin Philip
365d3d3921 Implement DataSet Serialization 2018-09-25 13:58:39 -04:00
Haocheng LIU
5c797169ec Use the strong typed enums for vtkm::cont::Field
Since Field association is used either when creating or working
with 'vtkm::cont::Field', it's put in the class itself.
2018-05-22 11:44:51 -04:00
Utkarsh Ayachit
cb7cbdbcf9 fixes #220: pass only requested fields.
Adding API to DataSet to `CopyStructure` from another dataset. This
copies the cellsets and coordinate systems while leaving the fields
unchanged.

CreateResult no longer copies all input fields to the output dataset
created.

Furthermore, if a Filter subclass doesn't provide `MapFieldOntoOutput`,
then the default implementation simply copies only the selected fields
to the output dataset.
2018-04-20 14:22:47 -04:00
Robert Maynard
3eb8294b24 Build vtkm::cont::DataSet into the vtkm_cont library. 2017-12-19 15:14:30 -05:00
Kenneth Moreland
c3a3184d51 Update copyright for Sandia
Sandia National Laboratories recently changed management from the
Sandia Corporation to the National Technology & Engineering Solutions
of Sandia, LLC (NTESS). The copyright statements need to be updated
accordingly.
2017-09-20 15:33:44 -06:00
Robert Maynard
5dd346007b Respect VTK-m convention of parameters all or nothing on a line
clang-format BinPack settings have been disabled to make sure that the
VTK-m style guideline is obeyed.
2017-05-26 13:53:28 -04:00
Kitware Robot
4ade5f5770 clang-format: apply to the entire tree 2017-05-25 07:51:37 -04:00
Kitware Robot
efbde1d54b clang-format: sort include directives 2017-05-18 12:59:33 -04:00
David C. Lonie
f601e38ba8 Simplify exception hierarchy.
Remove the ErrorControl class such that all subclasses now inherit from
error. Renamed all exception classes via s/ErrorControl/Error/.

See issue #57.
2017-02-07 15:42:38 -05:00
David C. Lonie
5020a8482f Add convenience getters for accessing field data by association. 2017-01-31 14:50:52 -05:00
Kenneth Moreland
fdaccc22db Remove exports for header-only functions/methods
Change the VTKM_CONT_EXPORT to VTKM_CONT. (Likewise for EXEC and
EXEC_CONT.) Remove the inline from these macros so that they can be
applied to everything, including implementations in a library.

Because inline is not declared in these modifies, you have to add the
keyword to functions and methods where the implementation is not inlined
in the class.
2016-11-15 22:22:13 -07:00
T.J. Corona
8ad8eeda77 In DynamicCellSet, expose CellSet API.
Also changes GetCellSet() to CastToBase().
2016-08-02 13:39:25 -04:00
Kenneth Moreland
f4362a4902 Give result classes their own header file.
VTK-m style guidelines dictate that all classes part of the API should
be in their own header file. Thus, we have moved the result classes out
of the filter header files and into their own headers.

We have also renamed these clases to ResultField and ResultDataSet to
better match the class naming conventions of VTK-m.

Since we are moving around these result classes, we have also revamped
their structure. They are now in a hierarchy with a common ResultBase
class. Additionally, all result classes have a reference to a complete
DataSet that can be considered the output of the filter. This will make
it easier for users to consistently deal with filter results.

These changes cover issues #60 and #62.
2016-05-05 15:07:55 -06:00
Kenneth Moreland
cc497e6a1b Remove cont/Assert.h and exec/Assert.h
These asserts are consolidated into the unified Assert.h. Also made some
minor edits to add asserts where appropriate and a little bit of
reconfiguring as found.
2016-04-20 15:41:14 -06:00
Kenneth Moreland
e863ee991a Change interface of VTKDataSetWriter
Make it match VTKDataSetReader better. It's also a bit easier to use
because you just have to give it a filename rather than open your own file
stream.
2016-03-16 15:35:38 -06:00