From 87958624d8d793f5e4a17a6209557e6d5af0e0b1 Mon Sep 17 00:00:00 2001 From: Dominik Gresch Date: Thu, 6 Jul 2023 14:11:47 +0200 Subject: [PATCH 1/3] Add mesh query API --- src/ansys/api/acp/v0/array_types.proto | 5 +++++ src/ansys/api/acp/v0/mesh_query.proto | 17 +++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 src/ansys/api/acp/v0/mesh_query.proto diff --git a/src/ansys/api/acp/v0/array_types.proto b/src/ansys/api/acp/v0/array_types.proto index 4357e92..7bf9b3c 100644 --- a/src/ansys/api/acp/v0/array_types.proto +++ b/src/ansys/api/acp/v0/array_types.proto @@ -10,3 +10,8 @@ message IntArray { repeated int64 data = 1 [packed=true]; repeated int64 shape = 2 [packed=true]; } + +message Int32Array { + repeated int32 data = 1 [packed=true]; + repeated int64 shape = 2 [packed=true]; +} diff --git a/src/ansys/api/acp/v0/mesh_query.proto b/src/ansys/api/acp/v0/mesh_query.proto new file mode 100644 index 0000000..c9191d7 --- /dev/null +++ b/src/ansys/api/acp/v0/mesh_query.proto @@ -0,0 +1,17 @@ +syntax = "proto3"; +package ansys.api.acp.v0.mesh_query; + +import "ansys/api/acp/v0/base.proto"; +import "ansys/api/acp/v0/array_types.proto"; + +message Mesh { + array_types.DoubleArray nodes = 1; + array_types.Int32Array element_nodes = 2; + array_types.Int32Array element_nodes_offsets = 3; + array_types.Int32Array element_types = 4; +} + +service ObjectService { + // GetRequest should contain the model resource_path. + rpc GetMesh (base.GetRequest) returns (Mesh); +} From 2d0758d54e9976da75fd3b89104645cee165e992 Mon Sep 17 00:00:00 2001 From: Dominik Gresch Date: Tue, 11 Jul 2023 15:23:25 +0200 Subject: [PATCH 2/3] Extend mesh query API --- src/ansys/api/acp/v0/mesh_query.proto | 97 +++++++++++++++++++++++++-- 1 file changed, 90 insertions(+), 7 deletions(-) diff --git a/src/ansys/api/acp/v0/mesh_query.proto b/src/ansys/api/acp/v0/mesh_query.proto index c9191d7..d65a99a 100644 --- a/src/ansys/api/acp/v0/mesh_query.proto +++ b/src/ansys/api/acp/v0/mesh_query.proto @@ -4,14 +4,97 @@ package ansys.api.acp.v0.mesh_query; import "ansys/api/acp/v0/base.proto"; import "ansys/api/acp/v0/array_types.proto"; -message Mesh { - array_types.DoubleArray nodes = 1; - array_types.Int32Array element_nodes = 2; - array_types.Int32Array element_nodes_offsets = 3; +message DataArray { + oneof data { + array_types.DoubleArray double_array = 1; + array_types.IntArray int_array = 2; + array_types.Int32Array int32_array = 3; + } +} + +message MeshData { + array_types.Int32Array node_labels = 1; + array_types.DoubleArray node_coordinates = 2; + array_types.Int32Array element_labels = 3; array_types.Int32Array element_types = 4; + array_types.Int32Array element_nodes = 5; + array_types.Int32Array element_nodes_offsets = 6; +} + +enum ElementalDataType { + ELEMENT_COORDINATES = 0; + ELEMENT_NORMAL = 1; + ELEMENT_ORIENTATION = 2; + ELEMENT_REFERENCE_DIRECTION = 3; + ELEMENT_FIBER_DIRECTION = 4; + ELEMENT_DRAPED_FIBER_DIRECTION = 5; + ELEMENT_TRANSVERSE_DIRECTION = 6; + ELEMENT_DRAPED_TRANSVERSE_DIRECTION = 7; + ELEMENT_THICKNESS = 8; + ELEMENT_RELATIVE_THICKNESS_CORRECTION = 9; + ELEMENT_DESIGN_ANGLE = 10; + ELEMENT_SHEAR_ANGLE = 11; + ELEMENT_DRAPED_FIBER_ANGLE = 12; + ELEMENT_DRAPED_TRANSVERSE_ANGLE = 13; + ELEMENT_AREA = 14; + ELEMENT_PRICE = 15; + ELEMENT_VOLUME = 16; + ELEMENT_MASS = 17; + ELEMENT_OFFSET = 18; + ELEMENT_MATERIAL_1_DIRECTION = 19; + ELEMENT_COG = 20; + // NOTE dgresch July '23: The elemental ply offset query currently returns the + // ply offset in absolute coordinates, instead of relative to the element. Since + // this is inconsistent with the nodal ply_offset, this query is currently + // disabled. + // ELEMENT_PLY_OFFSET = 21; +} + +// message ElementScoping { +// enum ElementType { +// ALL = 0; +// SHELL = 1; +// SOLID = 2; +// } +// ElementType element_type = 1; +// } + +message GetElementalDataRequest { + // The resource path determines both the entity whose data is being queried, + // as well as the scope for the elements. + // For example, if the resource path is models/, then the data will be + // returned for all elements in the model. + // If the resource path represents a Modeling Ply, the scope will be limited + // to the elements in the ply, and the element data corresponding to the + // ply will be returned. + base.ResourcePath resource_path = 1; + repeated ElementalDataType data_types = 2; + // ElementScoping scoping = 3; +} + +message ElementalData { + array_types.Int32Array labels = 1; + repeated ElementalDataType data_types = 2; + repeated DataArray data_arrays = 3; +} + +enum NodalDataType { + NODE_PLY_OFFSET = 0; +} + +message GetNodalDataRequest { + base.ResourcePath resource_path = 1; + repeated NodalDataType data_types = 2; +} + +message NodalData { + array_types.Int32Array labels = 1; + repeated NodalDataType data_types = 2; + repeated DataArray data_arrays = 3; } -service ObjectService { - // GetRequest should contain the model resource_path. - rpc GetMesh (base.GetRequest) returns (Mesh); +service MeshQueryService { + rpc GetMeshData (base.GetRequest) returns (MeshData); + rpc GetElementalData (GetElementalDataRequest) returns (ElementalData); + rpc GetNodalData (GetNodalDataRequest) returns (NodalData); } From 8a0daeec8c1dc460bc3a8ce114b3dcf3c59baf45 Mon Sep 17 00:00:00 2001 From: Dominik Gresch Date: Fri, 14 Jul 2023 13:14:36 +0200 Subject: [PATCH 3/3] Format .proto files --- src/ansys/api/acp/v0/array_types.proto | 12 ++++----- src/ansys/api/acp/v0/base.proto | 19 ++++---------- src/ansys/api/acp/v0/control.proto | 4 +-- src/ansys/api/acp/v0/cut_off_material.proto | 2 +- src/ansys/api/acp/v0/drop_off_material.proto | 3 +-- src/ansys/api/acp/v0/edge_set.proto | 4 +-- src/ansys/api/acp/v0/element_set.proto | 4 +-- src/ansys/api/acp/v0/enum_types.proto | 9 ++++--- src/ansys/api/acp/v0/fabric.proto | 4 +-- src/ansys/api/acp/v0/material.proto | 26 +++++++------------ src/ansys/api/acp/v0/mesh_query.proto | 17 ++++++------ src/ansys/api/acp/v0/model.proto | 11 +++----- src/ansys/api/acp/v0/modeling_group.proto | 7 ++--- src/ansys/api/acp/v0/modeling_ply.proto | 4 +-- .../api/acp/v0/oriented_selection_set.proto | 4 +-- src/ansys/api/acp/v0/ply_material.proto | 6 ++--- src/ansys/api/acp/v0/rosette.proto | 14 +++++----- 17 files changed, 56 insertions(+), 94 deletions(-) diff --git a/src/ansys/api/acp/v0/array_types.proto b/src/ansys/api/acp/v0/array_types.proto index 7bf9b3c..92ffaf5 100644 --- a/src/ansys/api/acp/v0/array_types.proto +++ b/src/ansys/api/acp/v0/array_types.proto @@ -2,16 +2,16 @@ syntax = "proto3"; package ansys.api.acp.v0.array_types; message DoubleArray { - repeated double data = 1 [packed=true]; - repeated int64 shape = 2 [packed=true]; + repeated double data = 1 [ packed = true ]; + repeated int64 shape = 2 [ packed = true ]; } message IntArray { - repeated int64 data = 1 [packed=true]; - repeated int64 shape = 2 [packed=true]; + repeated int64 data = 1 [ packed = true ]; + repeated int64 shape = 2 [ packed = true ]; } message Int32Array { - repeated int32 data = 1 [packed=true]; - repeated int64 shape = 2 [packed=true]; + repeated int32 data = 1 [ packed = true ]; + repeated int64 shape = 2 [ packed = true ]; } diff --git a/src/ansys/api/acp/v0/base.proto b/src/ansys/api/acp/v0/base.proto index 82339d7..75d0a92 100644 --- a/src/ansys/api/acp/v0/base.proto +++ b/src/ansys/api/acp/v0/base.proto @@ -1,16 +1,11 @@ syntax = "proto3"; package ansys.api.acp.v0.base; -message Empty { -} +message Empty {} -message ResourcePath { - string value = 1; -} +message ResourcePath { string value = 1; } -message CollectionPath { - string value = 1; -} +message CollectionPath { string value = 1; } message BasicInfo { ResourcePath resource_path = 1; @@ -19,15 +14,11 @@ message BasicInfo { int64 version = 4; } -message GetRequest { - ResourcePath resource_path = 1; -} +message GetRequest { ResourcePath resource_path = 1; } message DeleteRequest { ResourcePath resource_path = 1; int64 version = 2; } -message ListRequest { - CollectionPath collection_path = 1; -} +message ListRequest { CollectionPath collection_path = 1; } diff --git a/src/ansys/api/acp/v0/control.proto b/src/ansys/api/acp/v0/control.proto index 0e66792..d502316 100644 --- a/src/ansys/api/acp/v0/control.proto +++ b/src/ansys/api/acp/v0/control.proto @@ -3,6 +3,4 @@ package ansys.api.acp.v0.control; import "ansys/api/acp/v0/base.proto"; -service Control { - rpc ShutdownServer(base.Empty) returns (base.Empty); -} +service Control { rpc ShutdownServer(base.Empty) returns (base.Empty); } diff --git a/src/ansys/api/acp/v0/cut_off_material.proto b/src/ansys/api/acp/v0/cut_off_material.proto index eec20b2..7ee9d54 100644 --- a/src/ansys/api/acp/v0/cut_off_material.proto +++ b/src/ansys/api/acp/v0/cut_off_material.proto @@ -1,7 +1,7 @@ syntax = "proto3"; package ansys.api.acp.v0.cut_off_material; -//defines the source of the cut-off material +// defines the source of the cut-off material enum MaterialHandlingType { COMPUTED = 0; GLOBAL = 1; diff --git a/src/ansys/api/acp/v0/drop_off_material.proto b/src/ansys/api/acp/v0/drop_off_material.proto index 293271d..81318a5 100644 --- a/src/ansys/api/acp/v0/drop_off_material.proto +++ b/src/ansys/api/acp/v0/drop_off_material.proto @@ -1,9 +1,8 @@ syntax = "proto3"; package ansys.api.acp.v0.drop_off_material; -//defines the source of the drop-off material +// defines the source of the drop-off material enum MaterialHandlingType { GLOBAL = 0; CUSTOM = 1; } - diff --git a/src/ansys/api/acp/v0/edge_set.proto b/src/ansys/api/acp/v0/edge_set.proto index e3b8d16..41fd1f9 100644 --- a/src/ansys/api/acp/v0/edge_set.proto +++ b/src/ansys/api/acp/v0/edge_set.proto @@ -25,9 +25,7 @@ message ObjectInfo { Properties properties = 2; } -message ListReply { - repeated ObjectInfo objects = 1; -} +message ListReply { repeated ObjectInfo objects = 1; } message CreateRequest { base.CollectionPath collection_path = 1; diff --git a/src/ansys/api/acp/v0/element_set.proto b/src/ansys/api/acp/v0/element_set.proto index ee3314e..06d34f8 100644 --- a/src/ansys/api/acp/v0/element_set.proto +++ b/src/ansys/api/acp/v0/element_set.proto @@ -17,9 +17,7 @@ message ObjectInfo { Properties properties = 2; } -message ListReply { - repeated ObjectInfo objects = 1; -} +message ListReply { repeated ObjectInfo objects = 1; } message CreateRequest { base.CollectionPath collection_path = 1; diff --git a/src/ansys/api/acp/v0/enum_types.proto b/src/ansys/api/acp/v0/enum_types.proto index 7472520..e9bd58b 100644 --- a/src/ansys/api/acp/v0/enum_types.proto +++ b/src/ansys/api/acp/v0/enum_types.proto @@ -1,7 +1,8 @@ syntax = "proto3"; package ansys.api.acp.v0.enum_types; -//the initializers are different in the backend but here it has to be zero-based +// the initializers are different in the backend but here it has to be +// zero-based enum StatusType { UNKNOWN = 0; UPTODATE = 1; @@ -19,9 +20,9 @@ enum RosetteSelectionMethod { DIRECTIONS_FROM_TABULAR_VALUES = 7; } -//defines the ply type which is used for instance by the solid model -//extrusion and the post-processing to distinguish between isotropic, -//reinforced, and core materials +// defines the ply type which is used for instance by the solid model +// extrusion and the post-processing to distinguish between isotropic, +// reinforced, and core materials enum PlyType { REGULAR = 0; WOVEN = 1; diff --git a/src/ansys/api/acp/v0/fabric.proto b/src/ansys/api/acp/v0/fabric.proto index 7db9f9e..a58ac7d 100644 --- a/src/ansys/api/acp/v0/fabric.proto +++ b/src/ansys/api/acp/v0/fabric.proto @@ -25,9 +25,7 @@ message ObjectInfo { Properties properties = 2; } -message ListReply { - repeated ObjectInfo objects = 1; -} +message ListReply { repeated ObjectInfo objects = 1; } message CreateRequest { base.CollectionPath collection_path = 1; diff --git a/src/ansys/api/acp/v0/material.proto b/src/ansys/api/acp/v0/material.proto index 3530c79..029f852 100644 --- a/src/ansys/api/acp/v0/material.proto +++ b/src/ansys/api/acp/v0/material.proto @@ -21,9 +21,7 @@ message InterpolationOptions { } message DensityPropertySet { - message Data { - double rho = 1; - } + message Data { double rho = 1; } repeated Data values = 1; repeated FieldVariable field_variables = 2; InterpolationOptions interpolation_options = 3; @@ -57,9 +55,7 @@ message OrthotropicEngineeringConstantsPropertySet { } message IsotropicStressLimitsPropertySet { - message Data { - double effective_stress = 1; - } + message Data { double effective_stress = 1; } repeated Data values = 1; repeated FieldVariable field_variables = 2; InterpolationOptions interpolation_options = 3; @@ -82,9 +78,7 @@ message OrthotropicStressLimitsPropertySet { } message IsotropicStrainLimitsPropertySet { - message Data { - double effective_strain = 1; - } + message Data { double effective_strain = 1; } repeated Data values = 1; repeated FieldVariable field_variables = 2; InterpolationOptions interpolation_options = 3; @@ -167,9 +161,7 @@ message LaRCConstantsPropertySet { } message FabricFiberAnglePropertySet { - message Data { - double fabric_fiber_angle = 1; - } + message Data { double fabric_fiber_angle = 1; } repeated Data values = 1; repeated FieldVariable field_variables = 2; InterpolationOptions interpolation_options = 3; @@ -199,8 +191,10 @@ message Properties { message PropertySets { DensityPropertySet density = 1; oneof engineering_constants { - IsotropicEngineeringConstantsPropertySet engineering_constants_isotropic = 2; - OrthotropicEngineeringConstantsPropertySet engineering_constants_orthotropic = 3; + IsotropicEngineeringConstantsPropertySet + engineering_constants_isotropic = 2; + OrthotropicEngineeringConstantsPropertySet + engineering_constants_orthotropic = 3; } oneof stress_limits { IsotropicStressLimitsPropertySet stress_limits_isotropic = 4; @@ -232,9 +226,7 @@ message ObjectInfo { Properties properties = 2; } -message ListReply { - repeated ObjectInfo objects = 1; -} +message ListReply { repeated ObjectInfo objects = 1; } message CreateRequest { base.CollectionPath collection_path = 1; diff --git a/src/ansys/api/acp/v0/mesh_query.proto b/src/ansys/api/acp/v0/mesh_query.proto index d65a99a..b7a9ea3 100644 --- a/src/ansys/api/acp/v0/mesh_query.proto +++ b/src/ansys/api/acp/v0/mesh_query.proto @@ -43,11 +43,10 @@ enum ElementalDataType { ELEMENT_OFFSET = 18; ELEMENT_MATERIAL_1_DIRECTION = 19; ELEMENT_COG = 20; - // NOTE dgresch July '23: The elemental ply offset query currently returns the - // ply offset in absolute coordinates, instead of relative to the element. Since - // this is inconsistent with the nodal ply_offset, this query is currently - // disabled. - // ELEMENT_PLY_OFFSET = 21; + // NOTE dgresch July '23: The elemental ply offset query currently returns + // the ply offset in absolute coordinates, instead of relative to the + // element. Since this is inconsistent with the nodal ply_offset, this query + // is currently disabled. ELEMENT_PLY_OFFSET = 21; } // message ElementScoping { @@ -93,8 +92,8 @@ message NodalData { repeated DataArray data_arrays = 3; } -service MeshQueryService { - rpc GetMeshData (base.GetRequest) returns (MeshData); - rpc GetElementalData (GetElementalDataRequest) returns (ElementalData); - rpc GetNodalData (GetNodalDataRequest) returns (NodalData); +service MeshQueryService { + rpc GetMeshData(base.GetRequest) returns (MeshData); + rpc GetElementalData(GetElementalDataRequest) returns (ElementalData); + rpc GetNodalData(GetNodalDataRequest) returns (NodalData); } diff --git a/src/ansys/api/acp/v0/model.proto b/src/ansys/api/acp/v0/model.proto index 7bf462d..557fc98 100644 --- a/src/ansys/api/acp/v0/model.proto +++ b/src/ansys/api/acp/v0/model.proto @@ -26,13 +26,9 @@ message ObjectInfo { Properties properties = 2; } -message ListReply { - repeated ObjectInfo objects = 1; -} +message ListReply { repeated ObjectInfo objects = 1; } -message LoadFromFileRequest { - string path = 1; -} +message LoadFromFileRequest { string path = 1; } // Special Model messages @@ -99,5 +95,6 @@ service ObjectService { rpc SaveAnalysisModel(SaveAnalysisModelRequest) returns (base.Empty); - rpc SaveShellCompositeDefinitions(SaveShellCompositeDefinitionsRequest) returns (base.Empty); + rpc SaveShellCompositeDefinitions(SaveShellCompositeDefinitionsRequest) + returns (base.Empty); } diff --git a/src/ansys/api/acp/v0/modeling_group.proto b/src/ansys/api/acp/v0/modeling_group.proto index 48095af..c00f65f 100644 --- a/src/ansys/api/acp/v0/modeling_group.proto +++ b/src/ansys/api/acp/v0/modeling_group.proto @@ -3,17 +3,14 @@ package ansys.api.acp.v0.modeling_group; import "ansys/api/acp/v0/base.proto"; -message Properties { -} +message Properties {} message ObjectInfo { base.BasicInfo info = 1; Properties properties = 2; } -message ListReply { - repeated ObjectInfo objects = 1; -} +message ListReply { repeated ObjectInfo objects = 1; } message CreateRequest { base.CollectionPath collection_path = 1; diff --git a/src/ansys/api/acp/v0/modeling_ply.proto b/src/ansys/api/acp/v0/modeling_ply.proto index bc424c3..6e47cfb 100644 --- a/src/ansys/api/acp/v0/modeling_ply.proto +++ b/src/ansys/api/acp/v0/modeling_ply.proto @@ -19,9 +19,7 @@ message ObjectInfo { Properties properties = 2; } -message ListReply { - repeated ObjectInfo objects = 1; -} +message ListReply { repeated ObjectInfo objects = 1; } message CreateRequest { base.CollectionPath collection_path = 1; diff --git a/src/ansys/api/acp/v0/oriented_selection_set.proto b/src/ansys/api/acp/v0/oriented_selection_set.proto index ff52788..8e4c084 100644 --- a/src/ansys/api/acp/v0/oriented_selection_set.proto +++ b/src/ansys/api/acp/v0/oriented_selection_set.proto @@ -22,9 +22,7 @@ message ObjectInfo { Properties properties = 2; } -message ListReply { - repeated ObjectInfo objects = 1; -} +message ListReply { repeated ObjectInfo objects = 1; } message CreateRequest { base.CollectionPath collection_path = 1; diff --git a/src/ansys/api/acp/v0/ply_material.proto b/src/ansys/api/acp/v0/ply_material.proto index fc01c7f..2d80152 100644 --- a/src/ansys/api/acp/v0/ply_material.proto +++ b/src/ansys/api/acp/v0/ply_material.proto @@ -1,14 +1,14 @@ syntax = "proto3"; package ansys.api.acp.v0.ply_material; -//defines the draping model (algorithm) +// defines the draping model (algorithm) enum DrapingMaterialType { WOVEN = 0; UD = 1; } -//defines the symmetry-type for stackups, sublaminates etc -enum SymmetryType { +// defines the symmetry-type for stackups, sublaminates etc +enum SymmetryType { NO_SYMMETRY = 0; EVEN_SYMMETRY = 1; ODD_SYMMETRY = 2; diff --git a/src/ansys/api/acp/v0/rosette.proto b/src/ansys/api/acp/v0/rosette.proto index e400782..29e0536 100644 --- a/src/ansys/api/acp/v0/rosette.proto +++ b/src/ansys/api/acp/v0/rosette.proto @@ -6,11 +6,11 @@ import "ansys/api/acp/v0/enum_types.proto"; import "ansys/api/acp/v0/array_types.proto"; enum Type { - PARALLEL = 0; - RADIAL = 1; - CYLINDRICAL = 2; - SPHERICAL = 3; - EDGE_WISE = 4; + PARALLEL = 0; + RADIAL = 1; + CYLINDRICAL = 2; + SPHERICAL = 3; + EDGE_WISE = 4; } message Properties { @@ -27,9 +27,7 @@ message ObjectInfo { Properties properties = 2; } -message ListReply { - repeated ObjectInfo objects = 1; -} +message ListReply { repeated ObjectInfo objects = 1; } message CreateRequest { base.CollectionPath collection_path = 1;