From a4db9e7c636011f3b6b01e72ecd7c1b2a0a860d2 Mon Sep 17 00:00:00 2001 From: Dominik Gresch Date: Mon, 14 Aug 2023 14:50:21 +0200 Subject: [PATCH 1/2] Add look-up tables and dimension type --- src/ansys/api/acp/v0/lookup_table_1d.proto | 37 +++++++++++++++ .../api/acp/v0/lookup_table_1d_column.proto | 47 +++++++++++++++++++ src/ansys/api/acp/v0/lookup_table_3d.proto | 45 ++++++++++++++++++ .../api/acp/v0/lookup_table_3d_column.proto | 47 +++++++++++++++++++ src/ansys/api/acp/v0/unit_system.proto | 10 ++++ 5 files changed, 186 insertions(+) create mode 100644 src/ansys/api/acp/v0/lookup_table_1d.proto create mode 100644 src/ansys/api/acp/v0/lookup_table_1d_column.proto create mode 100644 src/ansys/api/acp/v0/lookup_table_3d.proto create mode 100644 src/ansys/api/acp/v0/lookup_table_3d_column.proto diff --git a/src/ansys/api/acp/v0/lookup_table_1d.proto b/src/ansys/api/acp/v0/lookup_table_1d.proto new file mode 100644 index 0000000..c9e656b --- /dev/null +++ b/src/ansys/api/acp/v0/lookup_table_1d.proto @@ -0,0 +1,37 @@ +syntax = "proto3"; +package ansys.api.acp.v0.lookup_table_1d; + +import "ansys/api/acp/v0/base.proto"; +import "ansys/api/acp/v0/enum_types.proto"; +import "ansys/api/acp/v0/array_types.proto"; + +message Properties { + enum_types.StatusType status = 1; + array_types.DoubleArray origin = 2; + array_types.DoubleArray direction = 3; +} + +message ObjectInfo { + base.BasicInfo info = 1; + Properties properties = 2; +} + +message ListReply { repeated ObjectInfo objects = 1; } + +message CreateRequest { + base.CollectionPath collection_path = 1; + string name = 2; + Properties properties = 3; +} + +service ObjectService { + rpc List(base.ListRequest) returns (ListReply); + + rpc Get(base.GetRequest) returns (ObjectInfo); + + rpc Put(ObjectInfo) returns (ObjectInfo); + + rpc Delete(base.DeleteRequest) returns (base.Empty); + + rpc Create(CreateRequest) returns (ObjectInfo); +} diff --git a/src/ansys/api/acp/v0/lookup_table_1d_column.proto b/src/ansys/api/acp/v0/lookup_table_1d_column.proto new file mode 100644 index 0000000..1046dc9 --- /dev/null +++ b/src/ansys/api/acp/v0/lookup_table_1d_column.proto @@ -0,0 +1,47 @@ +syntax = "proto3"; +package ansys.api.acp.v0.lookup_table_1d_column; + +import "ansys/api/acp/v0/base.proto"; +import "ansys/api/acp/v0/unit_system.proto"; +import "ansys/api/acp/v0/array_types.proto"; + +enum ValueType { + // The 'LOCATION' value type is not '0' (unlike in the backend enum) + // because otherwise the 'Create' method cannot be used with a default + // protobuf message (since the location column is protected, and always + // exists exactly once per lookup table). + SCALAR = 0; + DIRECTION = 1; + LOCATION = 2; +} + +message Properties { + ValueType value_type = 1; + unit_system.DimensionType dimension_type = 2; + array_types.DoubleArray data = 3; +} + +message ObjectInfo { + base.BasicInfo info = 1; + Properties properties = 2; +} + +message ListReply { repeated ObjectInfo objects = 1; } + +message CreateRequest { + base.CollectionPath collection_path = 1; + string name = 2; + Properties properties = 3; +} + +service ObjectService { + rpc List(base.ListRequest) returns (ListReply); + + rpc Get(base.GetRequest) returns (ObjectInfo); + + rpc Put(ObjectInfo) returns (ObjectInfo); + + rpc Delete(base.DeleteRequest) returns (base.Empty); + + rpc Create(CreateRequest) returns (ObjectInfo); +} diff --git a/src/ansys/api/acp/v0/lookup_table_3d.proto b/src/ansys/api/acp/v0/lookup_table_3d.proto new file mode 100644 index 0000000..9247446 --- /dev/null +++ b/src/ansys/api/acp/v0/lookup_table_3d.proto @@ -0,0 +1,45 @@ +syntax = "proto3"; +package ansys.api.acp.v0.lookup_table_3d; + +import "ansys/api/acp/v0/base.proto"; +import "ansys/api/acp/v0/enum_types.proto"; + +// TODO: merge with 'algorithm' string used in the material properties? +enum InterpolationAlgorithm { + WEIGHTED_NEAREST_NEIGHBOR = 0; + NEAREST_NEIGHBOR = 1; + LINEAR_TRIANGULATION = 2; +} + +message Properties { + enum_types.StatusType status = 1; + InterpolationAlgorithm interpolation_algorithm = 2; + bool use_default_search_radius = 3; + double search_radius = 4; + int64 num_min_neighbors = 5; +} + +message ObjectInfo { + base.BasicInfo info = 1; + Properties properties = 2; +} + +message ListReply { repeated ObjectInfo objects = 1; } + +message CreateRequest { + base.CollectionPath collection_path = 1; + string name = 2; + Properties properties = 3; +} + +service ObjectService { + rpc List(base.ListRequest) returns (ListReply); + + rpc Get(base.GetRequest) returns (ObjectInfo); + + rpc Put(ObjectInfo) returns (ObjectInfo); + + rpc Delete(base.DeleteRequest) returns (base.Empty); + + rpc Create(CreateRequest) returns (ObjectInfo); +} diff --git a/src/ansys/api/acp/v0/lookup_table_3d_column.proto b/src/ansys/api/acp/v0/lookup_table_3d_column.proto new file mode 100644 index 0000000..f2fdf54 --- /dev/null +++ b/src/ansys/api/acp/v0/lookup_table_3d_column.proto @@ -0,0 +1,47 @@ +syntax = "proto3"; +package ansys.api.acp.v0.lookup_table_3d_column; + +import "ansys/api/acp/v0/base.proto"; +import "ansys/api/acp/v0/unit_system.proto"; +import "ansys/api/acp/v0/array_types.proto"; + +enum ValueType { + // The 'LOCATION' value type is not '0' (unlike in the backend enum) + // because otherwise the 'Create' method cannot be used with a default + // protobuf message (since the location column is protected, and always + // exists exactly once per lookup table). + SCALAR = 0; + DIRECTION = 1; + LOCATION = 2; +} + +message Properties { + ValueType value_type = 1; + unit_system.DimensionType dimension_type = 2; + array_types.DoubleArray data = 3; +} + +message ObjectInfo { + base.BasicInfo info = 1; + Properties properties = 2; +} + +message ListReply { repeated ObjectInfo objects = 1; } + +message CreateRequest { + base.CollectionPath collection_path = 1; + string name = 2; + Properties properties = 3; +} + +service ObjectService { + rpc List(base.ListRequest) returns (ListReply); + + rpc Get(base.GetRequest) returns (ObjectInfo); + + rpc Put(ObjectInfo) returns (ObjectInfo); + + rpc Delete(base.DeleteRequest) returns (base.Empty); + + rpc Create(CreateRequest) returns (ObjectInfo); +} diff --git a/src/ansys/api/acp/v0/unit_system.proto b/src/ansys/api/acp/v0/unit_system.proto index 5d4818c..c711fa0 100644 --- a/src/ansys/api/acp/v0/unit_system.proto +++ b/src/ansys/api/acp/v0/unit_system.proto @@ -12,3 +12,13 @@ enum UnitSystemType { BFT = 6; BIN = 7; } + +enum DimensionType { + DIMENSIONLESS = 0; + LENGTH = 1; + MASS = 2; + FORCE = 3; + TIME = 4; + TEMPERATURE = 5; + CURRENCY = 6; +} From bb52d48a2832068ba588528949bcc88af41532b0 Mon Sep 17 00:00:00 2001 From: Dominik Gresch Date: Mon, 14 Aug 2023 15:00:59 +0200 Subject: [PATCH 2/2] Move ValueType to separate file --- src/ansys/api/acp/v0/lookup_table_1d_column.proto | 13 ++----------- src/ansys/api/acp/v0/lookup_table_3d_column.proto | 13 ++----------- src/ansys/api/acp/v0/lookup_table_column_type.proto | 12 ++++++++++++ 3 files changed, 16 insertions(+), 22 deletions(-) create mode 100644 src/ansys/api/acp/v0/lookup_table_column_type.proto diff --git a/src/ansys/api/acp/v0/lookup_table_1d_column.proto b/src/ansys/api/acp/v0/lookup_table_1d_column.proto index 1046dc9..0a82d8b 100644 --- a/src/ansys/api/acp/v0/lookup_table_1d_column.proto +++ b/src/ansys/api/acp/v0/lookup_table_1d_column.proto @@ -4,19 +4,10 @@ package ansys.api.acp.v0.lookup_table_1d_column; import "ansys/api/acp/v0/base.proto"; import "ansys/api/acp/v0/unit_system.proto"; import "ansys/api/acp/v0/array_types.proto"; - -enum ValueType { - // The 'LOCATION' value type is not '0' (unlike in the backend enum) - // because otherwise the 'Create' method cannot be used with a default - // protobuf message (since the location column is protected, and always - // exists exactly once per lookup table). - SCALAR = 0; - DIRECTION = 1; - LOCATION = 2; -} +import "ansys/api/acp/v0/lookup_table_column_type.proto"; message Properties { - ValueType value_type = 1; + lookup_table_column_type.ValueType value_type = 1; unit_system.DimensionType dimension_type = 2; array_types.DoubleArray data = 3; } diff --git a/src/ansys/api/acp/v0/lookup_table_3d_column.proto b/src/ansys/api/acp/v0/lookup_table_3d_column.proto index f2fdf54..d8ece26 100644 --- a/src/ansys/api/acp/v0/lookup_table_3d_column.proto +++ b/src/ansys/api/acp/v0/lookup_table_3d_column.proto @@ -4,19 +4,10 @@ package ansys.api.acp.v0.lookup_table_3d_column; import "ansys/api/acp/v0/base.proto"; import "ansys/api/acp/v0/unit_system.proto"; import "ansys/api/acp/v0/array_types.proto"; - -enum ValueType { - // The 'LOCATION' value type is not '0' (unlike in the backend enum) - // because otherwise the 'Create' method cannot be used with a default - // protobuf message (since the location column is protected, and always - // exists exactly once per lookup table). - SCALAR = 0; - DIRECTION = 1; - LOCATION = 2; -} +import "ansys/api/acp/v0/lookup_table_column_type.proto"; message Properties { - ValueType value_type = 1; + lookup_table_column_type.ValueType value_type = 1; unit_system.DimensionType dimension_type = 2; array_types.DoubleArray data = 3; } diff --git a/src/ansys/api/acp/v0/lookup_table_column_type.proto b/src/ansys/api/acp/v0/lookup_table_column_type.proto new file mode 100644 index 0000000..e436c8a --- /dev/null +++ b/src/ansys/api/acp/v0/lookup_table_column_type.proto @@ -0,0 +1,12 @@ +syntax = "proto3"; +package ansys.api.acp.v0.lookup_table_column_type; + +enum ValueType { + // The 'LOCATION' value type is not '0' (unlike in the backend enum) + // because otherwise the 'Create' method cannot be used with a default + // protobuf message (since the location column is protected, and always + // exists exactly once per lookup table). + SCALAR = 0; + DIRECTION = 1; + LOCATION = 2; +}