From b136616f375794273a50643ba38f6e3c65fd72ae Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Fri, 11 Apr 2025 11:07:29 +0200 Subject: [PATCH] Add clang-format config for proto files. --- .github/workflows/clang-format.yml | 5 + GrpcInterface/.clang-format | 2 + GrpcInterface/GrpcProtos/App.proto | 12 +- GrpcInterface/GrpcProtos/Case.proto | 185 +++--- GrpcInterface/GrpcProtos/Commands.proto | 616 ++++++++---------- GrpcInterface/GrpcProtos/Definitions.proto | 44 +- GrpcInterface/GrpcProtos/Grid.proto | 22 +- GrpcInterface/GrpcProtos/NNCProperties.proto | 95 ++- GrpcInterface/GrpcProtos/PdmObject.proto | 149 ++--- GrpcInterface/GrpcProtos/Properties.proto | 98 ++- GrpcInterface/GrpcProtos/SimulationWell.proto | 28 +- GrpcInterface/RiaGrpcCallbacks.h | 2 +- 12 files changed, 535 insertions(+), 723 deletions(-) diff --git a/.github/workflows/clang-format.yml b/.github/workflows/clang-format.yml index 7ec56bfd85..1a1a8d7dc0 100644 --- a/.github/workflows/clang-format.yml +++ b/.github/workflows/clang-format.yml @@ -36,6 +36,11 @@ jobs: cd Fwk/AppFwk find -name '*.h' -o -name '*.cpp' -o -name '*.inl' | grep -v gtest | xargs clang-format-18 -i git diff + - name: Check format - GrpcInterface + run: | + cd GrpcInterface + find -name '*.h' -o -name '*.cpp' -o -name '*.inl' -o -name '*.proto' | grep -v gtest | xargs clang-format-18 -i + git diff - uses: peter-evans/create-pull-request@v7 with: token: ${{ secrets.GITHUB_TOKEN }} diff --git a/GrpcInterface/.clang-format b/GrpcInterface/.clang-format index 78ba6a0887..89e55b7383 100644 --- a/GrpcInterface/.clang-format +++ b/GrpcInterface/.clang-format @@ -76,4 +76,6 @@ SpacesInSquareBrackets: false Standard: Cpp11 TabWidth: 4 UseTab: Never +--- +Language: Proto ... diff --git a/GrpcInterface/GrpcProtos/App.proto b/GrpcInterface/GrpcProtos/App.proto index 8bf88cbc5b..c8b8cdb8c8 100644 --- a/GrpcInterface/GrpcProtos/App.proto +++ b/GrpcInterface/GrpcProtos/App.proto @@ -18,13 +18,9 @@ message Version { int32 patch_version = 3; } -enum ApplicationTypeEnum -{ - GUI_APPLICATION = 0; - CONSOLE_APPLICATION = 1; +enum ApplicationTypeEnum { + GUI_APPLICATION = 0; + CONSOLE_APPLICATION = 1; } -message RuntimeInfo -{ - ApplicationTypeEnum app_type = 1; -} \ No newline at end of file +message RuntimeInfo { ApplicationTypeEnum app_type = 1; } \ No newline at end of file diff --git a/GrpcInterface/GrpcProtos/Case.proto b/GrpcInterface/GrpcProtos/Case.proto index 61b3acc3bb..076028612f 100644 --- a/GrpcInterface/GrpcProtos/Case.proto +++ b/GrpcInterface/GrpcProtos/Case.proto @@ -5,136 +5,101 @@ import "Definitions.proto"; package rips; -service Case -{ - rpc GetGridCount(CaseRequest) returns(GridCount) {} - rpc GetCellCount(CellInfoRequest) returns (CellCount) {} - rpc GetCellInfoForActiveCells(CellInfoRequest) returns (stream CellInfoArray) {} - rpc GetCellCenterForActiveCells(CellInfoRequest) returns (stream CellCenters) {} - rpc GetCellCornersForActiveCells(CellInfoRequest) returns (stream CellCornersArray) {} - rpc GetCoarseningInfoArray(CaseRequest) returns (CoarseningInfoArray) {} - rpc GetTimeSteps(CaseRequest) returns (TimeStepDates) {} - rpc GetSelectedCells(CaseRequest) returns (stream SelectedCells) {} - rpc GetDaysSinceStart(CaseRequest) returns (DaysSinceStart) {} - rpc GetCaseInfo(CaseRequest) returns (CaseInfo) {} - rpc GetPdmObject(CaseRequest) returns (PdmObject) {} - rpc GetReservoirBoundingBox(CaseRequest) returns (BoundingBox) {} +service Case { + rpc GetGridCount(CaseRequest) returns (GridCount) {} + rpc GetCellCount(CellInfoRequest) returns (CellCount) {} + rpc GetCellInfoForActiveCells(CellInfoRequest) + returns (stream CellInfoArray) {} + rpc GetCellCenterForActiveCells(CellInfoRequest) + returns (stream CellCenters) {} + rpc GetCellCornersForActiveCells(CellInfoRequest) + returns (stream CellCornersArray) {} + rpc GetCoarseningInfoArray(CaseRequest) returns (CoarseningInfoArray) {} + rpc GetTimeSteps(CaseRequest) returns (TimeStepDates) {} + rpc GetSelectedCells(CaseRequest) returns (stream SelectedCells) {} + rpc GetDaysSinceStart(CaseRequest) returns (DaysSinceStart) {} + rpc GetCaseInfo(CaseRequest) returns (CaseInfo) {} + rpc GetPdmObject(CaseRequest) returns (PdmObject) {} + rpc GetReservoirBoundingBox(CaseRequest) returns (BoundingBox) {} } -message CaseRequest { +message CaseRequest { int32 id = 1; } + +message CaseInfo { int32 id = 1; + int32 group_id = 2; + string name = 3; + string type = 4; } -message CaseInfo -{ - int32 id = 1; - int32 group_id = 2; - string name = 3; - string type = 4; +message CaseInfoArray { repeated CaseInfo data = 1; } + +message BoundingBox { + double min_x = 1; + double max_x = 2; + double min_y = 3; + double max_y = 4; + double min_z = 5; + double max_z = 6; } -message CaseInfoArray -{ - repeated CaseInfo data = 1; +message CaseGroup { + int32 id = 1; + string name = 2; } -message BoundingBox -{ - double min_x = 1; - double max_x = 2; - double min_y = 3; - double max_y = 4; - double min_z = 5; - double max_z = 6; +message CaseGroups { repeated CaseGroup case_groups = 1; } + +message GridCount { int32 count = 1; } + +message CellCount { + int32 active_cell_count = 1; + int32 reservoir_cell_count = 2; } -message CaseGroup -{ - int32 id = 1; - string name = 2; +enum PorosityModelType { + MATRIX_MODEL = 0; + FRACTURE_MODEL = 1; } -message CaseGroups -{ - repeated CaseGroup case_groups = 1; +message CellInfoRequest { + CaseRequest case_request = 1; + PorosityModelType porosity_model = 2; } -message GridCount -{ - int32 count = 1; +message CellInfoArray { repeated CellInfo data = 1; } + +message CellInfo { + int32 grid_index = 1; + int32 parent_grid_index = 2; + int32 coarsening_box_index = 3; + Vec3i local_ijk = 4; + Vec3i parent_ijk = 5; } -message CellCount -{ - int32 active_cell_count = 1; - int32 reservoir_cell_count = 2; +message CoarseningInfoArray { repeated CoarseningInfo data = 1; } + +message CoarseningInfo { + Vec3i min = 1; + Vec3i max = 2; } -enum PorosityModelType -{ - MATRIX_MODEL = 0; - FRACTURE_MODEL = 1; +message TimeStepDates { repeated TimeStepDate dates = 1; } + +message TimeStepDate { + int32 year = 1; + int32 month = 2; + int32 day = 3; + int32 hour = 4; + int32 minute = 5; + int32 second = 6; } -message CellInfoRequest -{ - CaseRequest case_request = 1; - PorosityModelType porosity_model = 2; +message DaysSinceStart { repeated double day_decimals = 1; } + +message SelectedCell { + int32 grid_index = 1; + Vec3i ijk = 2; } -message CellInfoArray -{ - repeated CellInfo data = 1; -} - -message CellInfo -{ - int32 grid_index = 1; - int32 parent_grid_index = 2; - int32 coarsening_box_index = 3; - Vec3i local_ijk = 4; - Vec3i parent_ijk = 5; -} - -message CoarseningInfoArray -{ - repeated CoarseningInfo data = 1; -} - -message CoarseningInfo -{ - Vec3i min = 1; - Vec3i max = 2; -} - -message TimeStepDates -{ - repeated TimeStepDate dates = 1; -} - -message TimeStepDate -{ - int32 year = 1; - int32 month = 2; - int32 day = 3; - int32 hour = 4; - int32 minute = 5; - int32 second = 6; -} - -message DaysSinceStart -{ - repeated double day_decimals = 1; -} - -message SelectedCell -{ - int32 grid_index = 1; - Vec3i ijk = 2; -} - - -message SelectedCells -{ - repeated SelectedCell cells = 1; -} +message SelectedCells { repeated SelectedCell cells = 1; } diff --git a/GrpcInterface/GrpcProtos/Commands.proto b/GrpcInterface/GrpcProtos/Commands.proto index 3d1db2b9d1..f16eb9e74d 100644 --- a/GrpcInterface/GrpcProtos/Commands.proto +++ b/GrpcInterface/GrpcProtos/Commands.proto @@ -8,451 +8,367 @@ package rips; /* * The Commands service handles generic ResInsight RicfCommandObject-commands - * The CommandParams is used to deduce command name from the chosen oneof-message + * The CommandParams is used to deduce command name from the chosen + * oneof-message * .. and the parameters are in the oneof-message itself. * Note that we several times duplicate nearly the same message. This is because * it is not recommended to reuse existing messages for different purposes. */ -service Commands -{ - rpc Execute(CommandParams) returns(CommandReply) {} +service Commands { + rpc Execute(CommandParams) returns (CommandReply) {} } -message FilePathRequest -{ - string path = 1; - bool gridOnly = 2; +message FilePathRequest { + string path = 1; + bool gridOnly = 2; } -message ReplaceCaseRequest -{ - string newGridFile = 1; - int32 caseId = 2; +message ReplaceCaseRequest { + string newGridFile = 1; + int32 caseId = 2; } -message ReplaceCaseRequests -{ - repeated ReplaceCaseRequest casePairs = 1; +message ReplaceCaseRequests { repeated ReplaceCaseRequest casePairs = 1; } + +message ReplaceSourceCasesRequest { + string gridListFile = 1; + int32 caseGroupId = 2; } -message ReplaceSourceCasesRequest -{ - string gridListFile = 1; - int32 caseGroupId = 2; +message ExportMultiCaseRequest { string gridListFile = 1; } + +enum PlotOutputFormat { + PNG = 0; + PDF = 1; } -message ExportMultiCaseRequest -{ - string gridListFile = 1; +enum SnapshotType { + VIEWS = 0; + PLOTS = 1; + ALL = 2; } -enum PlotOutputFormat -{ - PNG = 0; - PDF = 1; +message ExportSnapshotsRequest { + SnapshotType type = 1; + string prefix = 2; + int32 caseId = 3; + int32 viewId = 4; + string exportFolder = 5; + PlotOutputFormat plotOutputFormat = 6; } -enum SnapshotType -{ - VIEWS = 0; - PLOTS = 1; - ALL = 2; +message ExportPropertyRequest { + int32 caseId = 1; + int32 timeStep = 2; + string property = 3; + string eclipseKeyword = 4; + double undefinedValue = 5; + string exportFile = 6; } -message ExportSnapshotsRequest -{ - SnapshotType type = 1; - string prefix = 2; - int32 caseId = 3; - int32 viewId = 4; - string exportFolder = 5; - PlotOutputFormat plotOutputFormat = 6; +message ExportPropertyInViewsRequest { + int32 caseId = 1; + repeated int32 viewIds = 2; + double undefinedValue = 3; } -message ExportPropertyRequest -{ - int32 caseId = 1; - int32 timeStep = 2; - string property = 3; - string eclipseKeyword = 4; - double undefinedValue = 5; - string exportFile = 6; +enum CompdatExportSplit { + UNIFIED_FILE = 0; + SPLIT_ON_WELL = 1; + SPLIT_ON_WELL_AND_COMPLETION_TYPE = 2; } -message ExportPropertyInViewsRequest -{ - int32 caseId = 1; - repeated int32 viewIds = 2; - double undefinedValue = 3; +enum CompdatExportType { + TRANSMISSIBILITIES = 0; + WPIMULT_AND_DEFAULT_CONNECTION_FACTORS = 1; + NO_COMPLETIONS = 2; } -enum CompdatExportSplit -{ - UNIFIED_FILE = 0; - SPLIT_ON_WELL = 1; - SPLIT_ON_WELL_AND_COMPLETION_TYPE = 2; +enum CompdatCombinationMode { + INDIVIDUALLY = 0; + COMBINED = 1; } -enum CompdatExportType -{ - TRANSMISSIBILITIES = 0; - WPIMULT_AND_DEFAULT_CONNECTION_FACTORS = 1; - NO_COMPLETIONS = 2; +message ExportWellPathCompRequest { + int32 caseId = 1; + int32 timeStep = 2; + repeated string wellPathNames = 3; + CompdatExportSplit fileSplit = 4; + CompdatExportType compdatExport = 5; + bool includePerforations = 6; + bool includeFishbones = 7; + bool excludeMainBoreForFishbones = 8; + CompdatCombinationMode combinationMode = 9; + string customFileName = 10; + bool exportComments = 11; + bool exportWelspec = 12; } -enum CompdatCombinationMode -{ - INDIVIDUALLY = 0; - COMBINED = 1; +message ExportSimWellPathFracRequest { + int32 caseId = 1; + int32 viewId = 2; + int32 timeStep = 3; + repeated string simulationWellNames = 4; + CompdatExportSplit fileSplit = 5; + CompdatExportType compdatExport = 6; } -message ExportWellPathCompRequest -{ - int32 caseId = 1; - int32 timeStep = 2; - repeated string wellPathNames = 3; - CompdatExportSplit fileSplit = 4; - CompdatExportType compdatExport = 5; - bool includePerforations = 6; - bool includeFishbones = 7; - bool excludeMainBoreForFishbones = 8; - CompdatCombinationMode combinationMode = 9; - string customFileName = 10; - bool exportComments = 11; - bool exportWelspec = 12; +message ExportMswRequest { + int32 caseId = 1; + string wellPath = 2; } -message ExportSimWellPathFracRequest -{ - int32 caseId = 1; - int32 viewId = 2; - int32 timeStep = 3; - repeated string simulationWellNames = 4; - CompdatExportSplit fileSplit = 5; - CompdatExportType compdatExport = 6; +message ExportWellPathRequest { + repeated string wellPathNames = 1; + double mdStepSize = 2; } -message ExportMswRequest -{ - int32 caseId = 1; - string wellPath = 2; +enum ExportVisibleCellsKeywordType { + FLUXNUM = 0; + MULTNUM = 1; + ACTNUM = 2; } -message ExportWellPathRequest -{ - repeated string wellPathNames = 1; - double mdStepSize = 2; -} - -enum ExportVisibleCellsKeywordType -{ - FLUXNUM = 0; - MULTNUM = 1; - ACTNUM = 2; -} - -message ExportVisibleCellsRequest -{ - int32 caseId = 1; - int32 viewId = 2; - ExportVisibleCellsKeywordType exportKeyword = 3; - int32 visibleActiveCellsValue = 4; - int32 hiddenActiveCellsValue = 5; - int32 inactiveCellsValue = 6; +message ExportVisibleCellsRequest { + int32 caseId = 1; + int32 viewId = 2; + ExportVisibleCellsKeywordType exportKeyword = 3; + int32 visibleActiveCellsValue = 4; + int32 hiddenActiveCellsValue = 5; + int32 inactiveCellsValue = 6; } enum ExportFolderType { - COMPLETIONS = 0; - SNAPSHOTS = 1; - PROPERTIES = 2; - STATISTICS = 3; - WELLPATHS = 4; - CELLS = 5; - LGRS = 6; + COMPLETIONS = 0; + SNAPSHOTS = 1; + PROPERTIES = 2; + STATISTICS = 3; + WELLPATHS = 4; + CELLS = 5; + LGRS = 6; } -message SetExportFolderRequest -{ - ExportFolderType type = 1; - string path = 2; - bool createFolder = 3; +message SetExportFolderRequest { + ExportFolderType type = 1; + string path = 2; + bool createFolder = 3; } -message RunOctaveScriptRequest -{ - string path = 1; - repeated int32 caseIds = 2; +message RunOctaveScriptRequest { + string path = 1; + repeated int32 caseIds = 2; } -message SetWindowSizeParams -{ - int32 height = 1; - int32 width = 2; +message SetWindowSizeParams { + int32 height = 1; + int32 width = 2; } -message ComputeCaseGroupStatRequest -{ - repeated int32 caseIds = 1; - int32 caseGroupId = 2; +message ComputeCaseGroupStatRequest { + repeated int32 caseIds = 1; + int32 caseGroupId = 2; } -message SetTimeStepParams -{ - int32 caseId = 1; - int32 viewId = 2; - int32 timeStep = 3; +message SetTimeStepParams { + int32 caseId = 1; + int32 viewId = 2; + int32 timeStep = 3; } -message ScaleFractureTemplateRequest -{ - int32 id = 1; - double halfLength = 2; - double height = 3; +message ScaleFractureTemplateRequest { + int32 id = 1; + double halfLength = 2; + double height = 3; } -message SetFracContainmentRequest -{ - int32 id = 1; - int32 topLayer = 2; - int32 baseLayer = 3; +message SetFracContainmentRequest { + int32 id = 1; + int32 topLayer = 2; + int32 baseLayer = 3; } -enum MultipleFracAction -{ - NONE = 0; - APPEND_FRACTURES = 1; - REPLACE_FRACTURES = 2; +enum MultipleFracAction { + NONE = 0; + APPEND_FRACTURES = 1; + REPLACE_FRACTURES = 2; } -message CreateMultipleFracRequest -{ - int32 caseId = 1; - int32 templateId = 2; - repeated string wellPathNames = 3; - double minDistFromWellTd = 4; - int32 maxFracturesPerWell = 5; - int32 topLayer = 6; - int32 baseLayer = 7; - int32 spacing = 8; - MultipleFracAction action = 9; +message CreateMultipleFracRequest { + int32 caseId = 1; + int32 templateId = 2; + repeated string wellPathNames = 3; + double minDistFromWellTd = 4; + int32 maxFracturesPerWell = 5; + int32 topLayer = 6; + int32 baseLayer = 7; + int32 spacing = 8; + MultipleFracAction action = 9; } -enum LgrSplitType -{ - LGR_PER_CELL = 0; - LGR_PER_COMPLETION = 1; - LGR_PER_WELL = 2; +enum LgrSplitType { + LGR_PER_CELL = 0; + LGR_PER_COMPLETION = 1; + LGR_PER_WELL = 2; } -message CreateLgrForCompRequest -{ - int32 caseId = 1; - int32 timeStep = 2; - repeated string wellPathNames = 3; - int32 refinementI = 4; - int32 refinementJ = 5; - int32 refinementK = 6; - LgrSplitType splitType = 7; +message CreateLgrForCompRequest { + int32 caseId = 1; + int32 timeStep = 2; + repeated string wellPathNames = 3; + int32 refinementI = 4; + int32 refinementJ = 5; + int32 refinementK = 6; + LgrSplitType splitType = 7; } -message CreateSatPressPlotRequest -{ - repeated int32 caseIds = 1; +message CreateSatPressPlotRequest { repeated int32 caseIds = 1; } + +message CreateGridCaseGroupRequest { repeated string casePaths = 1; } + +message CreateStatisticsCaseRequest { int32 caseGroupId = 1; } + +message ExportFlowInfoRequest { + int32 caseId = 1; + repeated int32 timeSteps = 2; + repeated string injectors = 3; + repeated string producers = 4; + string fileName = 5; + double minimumCommunication = 6; + double aquiferCellThreshold = 7; } -message CreateGridCaseGroupRequest -{ - repeated string casePaths = 1; +message CreateViewRequest { int32 caseId = 1; } + +message CloneViewRequest { int32 viewId = 1; } + +message CreateWbsPlotRequest { + int32 caseId = 1; + string wellPath = 2; + int32 timeStep = 3; + PdmObject wbsParameters = 4; } -message CreateStatisticsCaseRequest -{ - int32 caseGroupId = 1; +message ImportWellPathsRequest { + string wellPathFolder = 1; + repeated string wellPathFiles = 2; } -message ExportFlowInfoRequest -{ - int32 caseId = 1; - repeated int32 timeSteps = 2; - repeated string injectors = 3; - repeated string producers = 4; - string fileName = 5; - double minimumCommunication = 6; - double aquiferCellThreshold = 7; +message ImportWellLogFilesRequest { + string wellLogFolder = 1; + repeated string wellLogFiles = 2; } -message CreateViewRequest -{ - int32 caseId = 1; +message ImportFormationNamesRequest { + repeated string formationFiles = 1; + int32 applyToCaseId = 2; } -message CloneViewRequest -{ - int32 viewId = 1; +enum ExportFormat { + LAS = 0; + ASCII = 1; } -message CreateWbsPlotRequest -{ - int32 caseId = 1; - string wellPath = 2; - int32 timeStep = 3; - PdmObject wbsParameters = 4; +message ExportWellLogPlotDataRequest { + ExportFormat exportFormat = 1; + int32 viewId = 2; + string exportFolder = 3; + string filePrefix = 4; + bool exportTvdRkb = 5; + bool capitalizeFileNames = 6; + double resampleInterval = 7; + bool convertCurveUnits = 8; } -message ImportWellPathsRequest -{ - string wellPathFolder = 1; - repeated string wellPathFiles = 2; +message ExportContourMapToTextRequest { + string exportFileName = 1; + bool exportLocalCoordinates = 2; + string undefinedValueLabel = 3; + bool excludeUndefinedValues = 4; + int32 viewId = 5; } -message ImportWellLogFilesRequest -{ - string wellLogFolder = 1; - repeated string wellLogFiles = 2; -} - -message ImportFormationNamesRequest -{ - repeated string formationFiles = 1; - int32 applyToCaseId = 2; -} - -enum ExportFormat -{ - LAS = 0; - ASCII = 1; -} - -message ExportWellLogPlotDataRequest -{ - ExportFormat exportFormat = 1; - int32 viewId = 2; - string exportFolder = 3; - string filePrefix = 4; - bool exportTvdRkb = 5; - bool capitalizeFileNames = 6; - double resampleInterval = 7; - bool convertCurveUnits = 8; -} - -message ExportContourMapToTextRequest -{ - string exportFileName = 1; - bool exportLocalCoordinates = 2; - string undefinedValueLabel = 3; - bool excludeUndefinedValues = 4; - int32 viewId = 5; -} - -message SaveProjectRequest -{ - string filePath = 1; -} +message SaveProjectRequest { string filePath = 1; } /* CommandParams handles both command name and parameters in one. * The message type and content is used as parameters and * the name of the variable is used to find the command name. */ -message CommandParams -{ - /* Since only one of these oneof-parameters can be set, we know which - * command to run from the name of parameter. I.e. if openProject is set - * we will run the RicfOpenProject command with the parameters set in - * the FilePathRequest message. */ - oneof params - { - FilePathRequest openProject = 1; - Empty closeProject = 2; - FilePathRequest setStartDir = 3; - FilePathRequest loadCase = 4; - ReplaceCaseRequest replaceCase = 5; - ReplaceSourceCasesRequest replaceSourceCases = 6; - ExportMultiCaseRequest exportMultiCaseSnapshots = 7; - ExportSnapshotsRequest exportSnapshots = 8; - ExportPropertyRequest exportProperty = 9; - ExportPropertyInViewsRequest exportPropertyInViews = 10; - ExportWellPathCompRequest exportWellPathCompletions = 11; - ExportSimWellPathFracRequest exportSimWellFractureCompletions = 12; - ExportMswRequest exportMsw = 13; - ExportWellPathRequest exportWellPaths = 14; - ExportVisibleCellsRequest exportVisibleCells = 15; - SetExportFolderRequest setExportFolder = 16; - RunOctaveScriptRequest runOctaveScript = 17; - SetWindowSizeParams setMainWindowSize = 18; - ComputeCaseGroupStatRequest computeCaseGroupStatistics = 19; - SetTimeStepParams setTimeStep = 20; - ScaleFractureTemplateRequest scaleFractureTemplate = 21; - SetFracContainmentRequest setFractureContainment = 22; - CreateMultipleFracRequest createMultipleFractures = 23; - CreateLgrForCompRequest createLgrForCompletions = 24; - CreateSatPressPlotRequest createSaturationPressurePlots = 25; - ReplaceCaseRequests replaceMultipleCases = 26; - CreateGridCaseGroupRequest createGridCaseGroup = 27; - CreateStatisticsCaseRequest createStatisticsCase = 28; - ExportFlowInfoRequest exportFlowCharacteristics = 29; - CreateViewRequest createView = 30; - CloneViewRequest cloneView = 31; - CreateWbsPlotRequest createWellBoreStabilityPlot = 32; - ImportWellPathsRequest importWellPaths = 33; - ImportWellLogFilesRequest importWellLogFiles = 34; - ImportFormationNamesRequest importFormationNames = 35; - ExportWellLogPlotDataRequest exportWellLogPlotData = 36; - SetWindowSizeParams setPlotWindowSize = 37; - ExportContourMapToTextRequest exportContourMapToText = 38; - SaveProjectRequest saveProject = 39; - } +message CommandParams { + /* Since only one of these oneof-parameters can be set, we know which + * command to run from the name of parameter. I.e. if openProject is set + * we will run the RicfOpenProject command with the parameters set in + * the FilePathRequest message. */ + oneof params { + FilePathRequest openProject = 1; + Empty closeProject = 2; + FilePathRequest setStartDir = 3; + FilePathRequest loadCase = 4; + ReplaceCaseRequest replaceCase = 5; + ReplaceSourceCasesRequest replaceSourceCases = 6; + ExportMultiCaseRequest exportMultiCaseSnapshots = 7; + ExportSnapshotsRequest exportSnapshots = 8; + ExportPropertyRequest exportProperty = 9; + ExportPropertyInViewsRequest exportPropertyInViews = 10; + ExportWellPathCompRequest exportWellPathCompletions = 11; + ExportSimWellPathFracRequest exportSimWellFractureCompletions = 12; + ExportMswRequest exportMsw = 13; + ExportWellPathRequest exportWellPaths = 14; + ExportVisibleCellsRequest exportVisibleCells = 15; + SetExportFolderRequest setExportFolder = 16; + RunOctaveScriptRequest runOctaveScript = 17; + SetWindowSizeParams setMainWindowSize = 18; + ComputeCaseGroupStatRequest computeCaseGroupStatistics = 19; + SetTimeStepParams setTimeStep = 20; + ScaleFractureTemplateRequest scaleFractureTemplate = 21; + SetFracContainmentRequest setFractureContainment = 22; + CreateMultipleFracRequest createMultipleFractures = 23; + CreateLgrForCompRequest createLgrForCompletions = 24; + CreateSatPressPlotRequest createSaturationPressurePlots = 25; + ReplaceCaseRequests replaceMultipleCases = 26; + CreateGridCaseGroupRequest createGridCaseGroup = 27; + CreateStatisticsCaseRequest createStatisticsCase = 28; + ExportFlowInfoRequest exportFlowCharacteristics = 29; + CreateViewRequest createView = 30; + CloneViewRequest cloneView = 31; + CreateWbsPlotRequest createWellBoreStabilityPlot = 32; + ImportWellPathsRequest importWellPaths = 33; + ImportWellLogFilesRequest importWellLogFiles = 34; + ImportFormationNamesRequest importFormationNames = 35; + ExportWellLogPlotDataRequest exportWellLogPlotData = 36; + SetWindowSizeParams setPlotWindowSize = 37; + ExportContourMapToTextRequest exportContourMapToText = 38; + SaveProjectRequest saveProject = 39; + } } -message GridCaseGroupResult -{ - int32 groupId = 1; - string groupName = 2; +message GridCaseGroupResult { + int32 groupId = 1; + string groupName = 2; } -message CreateStatisticsCaseResult -{ - int32 caseId = 1; -} +message CreateStatisticsCaseResult { int32 caseId = 1; } -message CreateViewResult -{ - int32 viewId = 1; -} +message CreateViewResult { int32 viewId = 1; } -message CreateWbsPlotResult -{ - int32 viewId = 1; -} +message CreateWbsPlotResult { int32 viewId = 1; } -message ImportWellPathsResult -{ - repeated string wellPathNames = 1; -} +message ImportWellPathsResult { repeated string wellPathNames = 1; } -message ImportWellLogFilesResult -{ - repeated string wellPathNames = 1; -} +message ImportWellLogFilesResult { repeated string wellPathNames = 1; } -message ExportWellLogPlotDataResult -{ - repeated string exportedFiles = 1; -} +message ExportWellLogPlotDataResult { repeated string exportedFiles = 1; } /* Command reply handles the return values for the generic command * The name of the variable is used to map to the cafPdmObject classKeyword */ -message CommandReply -{ - oneof result - { - Empty emptyResult = 1; - CaseRequest loadCaseResult = 2; - GridCaseGroupResult createGridCaseGroupResult = 3; - CreateStatisticsCaseResult createStatisticsCaseResult = 4; - CreateViewResult createViewResult = 5; - CreateWbsPlotResult createWbsPlotResult = 6; - ImportWellPathsResult importWellPathsResult = 7; - ImportWellLogFilesResult importWellLogFilesResult = 8; - ExportWellLogPlotDataResult exportWellLogPlotDataResult = 9; - } +message CommandReply { + oneof result { + Empty emptyResult = 1; + CaseRequest loadCaseResult = 2; + GridCaseGroupResult createGridCaseGroupResult = 3; + CreateStatisticsCaseResult createStatisticsCaseResult = 4; + CreateViewResult createViewResult = 5; + CreateWbsPlotResult createWbsPlotResult = 6; + ImportWellPathsResult importWellPathsResult = 7; + ImportWellLogFilesResult importWellLogFilesResult = 8; + ExportWellLogPlotDataResult exportWellLogPlotDataResult = 9; + } } - diff --git a/GrpcInterface/GrpcProtos/Definitions.proto b/GrpcInterface/GrpcProtos/Definitions.proto index d6b6678d55..c75676ab84 100644 --- a/GrpcInterface/GrpcProtos/Definitions.proto +++ b/GrpcInterface/GrpcProtos/Definitions.proto @@ -2,14 +2,9 @@ syntax = "proto3"; package rips; -message Empty -{ -} +message Empty {} -message ClientToServerStreamReply -{ - int64 accepted_value_count = 1; -} +message ClientToServerStreamReply { int64 accepted_value_count = 1; } message Vec3i { int32 i = 1; @@ -17,30 +12,23 @@ message Vec3i { int32 k = 3; } -message Vec3d -{ - double x = 1; - double y = 2; - double z = 3; +message Vec3d { + double x = 1; + double y = 2; + double z = 3; } -message CellCenters -{ - repeated Vec3d centers = 1; -} +message CellCenters { repeated Vec3d centers = 1; } message CellCorners { - Vec3d c0 = 1; - Vec3d c1 = 2; - Vec3d c2 = 3; - Vec3d c3 = 4; - Vec3d c4 = 5; - Vec3d c5 = 6; - Vec3d c6 = 7; - Vec3d c7 = 8; + Vec3d c0 = 1; + Vec3d c1 = 2; + Vec3d c2 = 3; + Vec3d c3 = 4; + Vec3d c4 = 5; + Vec3d c5 = 6; + Vec3d c6 = 7; + Vec3d c7 = 8; } -message CellCornersArray -{ - repeated CellCorners cells = 1; -} +message CellCornersArray { repeated CellCorners cells = 1; } diff --git a/GrpcInterface/GrpcProtos/Grid.proto b/GrpcInterface/GrpcProtos/Grid.proto index d501747d04..6eafc6cabe 100644 --- a/GrpcInterface/GrpcProtos/Grid.proto +++ b/GrpcInterface/GrpcProtos/Grid.proto @@ -5,21 +5,15 @@ package rips; import "Definitions.proto"; import "Case.proto"; -service Grid -{ - rpc GetCellCenters(GridRequest) returns(stream CellCenters) {} - rpc GetCellCorners(GridRequest) returns(stream CellCornersArray) {} - rpc GetDimensions(GridRequest) returns (GridDimensions) {} +service Grid { + rpc GetCellCenters(GridRequest) returns (stream CellCenters) {} + rpc GetCellCorners(GridRequest) returns (stream CellCornersArray) {} + rpc GetDimensions(GridRequest) returns (GridDimensions) {} } -message GridRequest -{ - CaseRequest case_request = 1; - int32 grid_index = 2; -} - -message GridDimensions -{ - Vec3i dimensions = 1; +message GridRequest { + CaseRequest case_request = 1; + int32 grid_index = 2; } +message GridDimensions { Vec3i dimensions = 1; } diff --git a/GrpcInterface/GrpcProtos/NNCProperties.proto b/GrpcInterface/GrpcProtos/NNCProperties.proto index 8fa510c220..a07e77aa9c 100644 --- a/GrpcInterface/GrpcProtos/NNCProperties.proto +++ b/GrpcInterface/GrpcProtos/NNCProperties.proto @@ -5,72 +5,55 @@ import "Definitions.proto"; package rips; -service NNCProperties -{ - rpc GetAvailableNNCProperties(CaseRequest) returns (AvailableNNCProperties) {} - rpc GetNNCConnections(CaseRequest) returns (stream NNCConnections) {} - rpc GetNNCValues(NNCValuesRequest) returns (stream NNCValues) {} - rpc SetNNCValues(stream NNCValuesChunk) returns (ClientToServerStreamReply) {} +service NNCProperties { + rpc GetAvailableNNCProperties(CaseRequest) returns (AvailableNNCProperties) {} + rpc GetNNCConnections(CaseRequest) returns (stream NNCConnections) {} + rpc GetNNCValues(NNCValuesRequest) returns (stream NNCValues) {} + rpc SetNNCValues(stream NNCValuesChunk) returns (ClientToServerStreamReply) {} } -enum NNCPropertyType -{ - NNC_DYNAMIC = 0; - NNC_STATIC = 1; - NNC_GENERATED = 2; +enum NNCPropertyType { + NNC_DYNAMIC = 0; + NNC_STATIC = 1; + NNC_GENERATED = 2; } -message AvailableNNCProperty -{ - string name = 1; - NNCPropertyType property_type = 2; +message AvailableNNCProperty { + string name = 1; + NNCPropertyType property_type = 2; } -message AvailableNNCProperties -{ - repeated AvailableNNCProperty properties = 1; +message AvailableNNCProperties { repeated AvailableNNCProperty properties = 1; } + +message NNCConnection { + int32 cell_grid_index1 = 1; + int32 cell_grid_index2 = 2; + Vec3i cell1 = 3; + Vec3i cell2 = 4; } -message NNCConnection -{ - int32 cell_grid_index1 = 1; - int32 cell_grid_index2 = 2; - Vec3i cell1 = 3; - Vec3i cell2 = 4; +message NNCConnections { repeated NNCConnection connections = 1; } + +message NNCValuesRequest { + int32 case_id = 1; + string property_name = 2; + NNCPropertyType property_type = 3; + int32 time_step = 4; } -message NNCConnections -{ - repeated NNCConnection connections = 1; +message NNCValues { repeated double values = 1; } + +message NNCValuesInputRequest { + int32 case_id = 1; + string property_name = 2; + PorosityModelType porosity_model = 3; + int32 time_step = 4; } -message NNCValuesRequest -{ - int32 case_id = 1; - string property_name = 2; - NNCPropertyType property_type = 3; - int32 time_step = 4; -} - -message NNCValues -{ - repeated double values = 1; -} - -message NNCValuesInputRequest -{ - int32 case_id = 1; - string property_name = 2; - PorosityModelType porosity_model = 3; - int32 time_step = 4; -} - -message NNCValuesChunk -{ - oneof ChunkType - { - // Params needs to be sent in the first message - NNCValuesInputRequest params = 1; - NNCValues values = 2; - } +message NNCValuesChunk { + oneof ChunkType { + // Params needs to be sent in the first message + NNCValuesInputRequest params = 1; + NNCValues values = 2; + } } diff --git a/GrpcInterface/GrpcProtos/PdmObject.proto b/GrpcInterface/GrpcProtos/PdmObject.proto index d55aa11499..64620823e3 100644 --- a/GrpcInterface/GrpcProtos/PdmObject.proto +++ b/GrpcInterface/GrpcProtos/PdmObject.proto @@ -4,110 +4,87 @@ import "Definitions.proto"; package rips; -service PdmObjectService -{ - rpc GetDescendantPdmObjects(PdmDescendantObjectRequest) returns (PdmObjectArray) {} - rpc GetChildPdmObjects(PdmChildObjectRequest) returns (PdmObjectArray) {} - rpc GetAncestorPdmObject(PdmParentObjectRequest) returns (PdmObject) {} - rpc CreateChildPdmObject(CreatePdmChildObjectRequest) returns (PdmObject) {} - rpc UpdateExistingPdmObject(PdmObject) returns (Empty) {} - rpc CallPdmObjectGetter(PdmObjectGetterRequest) returns (stream PdmObjectGetterReply) {} - rpc CallPdmObjectSetter(stream PdmObjectSetterChunk) returns (ClientToServerStreamReply) {} - rpc CallPdmObjectMethod(PdmObjectMethodRequest) returns (PdmObject) {} - rpc DeleteExistingPdmObject(PdmObject) returns (Empty) {} +service PdmObjectService { + rpc GetDescendantPdmObjects(PdmDescendantObjectRequest) + returns (PdmObjectArray) {} + rpc GetChildPdmObjects(PdmChildObjectRequest) returns (PdmObjectArray) {} + rpc GetAncestorPdmObject(PdmParentObjectRequest) returns (PdmObject) {} + rpc CreateChildPdmObject(CreatePdmChildObjectRequest) returns (PdmObject) {} + rpc UpdateExistingPdmObject(PdmObject) returns (Empty) {} + rpc CallPdmObjectGetter(PdmObjectGetterRequest) + returns (stream PdmObjectGetterReply) {} + rpc CallPdmObjectSetter(stream PdmObjectSetterChunk) + returns (ClientToServerStreamReply) {} + rpc CallPdmObjectMethod(PdmObjectMethodRequest) returns (PdmObject) {} + rpc DeleteExistingPdmObject(PdmObject) returns (Empty) {} } -message PdmDescendantObjectRequest -{ - PdmObject object = 1; - string child_keyword = 2; +message PdmDescendantObjectRequest { + PdmObject object = 1; + string child_keyword = 2; } -message PdmChildObjectRequest -{ - PdmObject object = 1; - string child_field = 2; +message PdmChildObjectRequest { + PdmObject object = 1; + string child_field = 2; } -message CreatePdmChildObjectRequest -{ - PdmObject object = 1; - string child_field = 2; - string class_keyword = 3; +message CreatePdmChildObjectRequest { + PdmObject object = 1; + string child_field = 2; + string class_keyword = 3; } -message PdmParentObjectRequest -{ - PdmObject object = 1; - string parent_keyword = 2; +message PdmParentObjectRequest { + PdmObject object = 1; + string parent_keyword = 2; } -message PdmObject -{ - string class_keyword = 1; - uint64 address = 2; - map parameters = 3; - bool visible = 4; - bool persistent = 5; // Does this object live on in ResInsight? +message PdmObject { + string class_keyword = 1; + uint64 address = 2; + map parameters = 3; + bool visible = 4; + bool persistent = 5; // Does this object live on in ResInsight? } -message PdmObjectArray -{ - repeated PdmObject objects = 1; +message PdmObjectArray { repeated PdmObject objects = 1; } + +message PdmObjectGetterRequest { + PdmObject object = 1; + string method = 2; } -message PdmObjectGetterRequest -{ - PdmObject object = 1; - string method = 2; +message PdmObjectSetterRequest { + PdmObjectGetterRequest request = 1; + int32 data_count = 2; } -message PdmObjectSetterRequest -{ - PdmObjectGetterRequest request = 1; - int32 data_count = 2; +message PdmObjectSetterChunk { + oneof data { + PdmObjectSetterRequest set_request = 1; + DoubleArray doubles = 2; + IntArray ints = 3; + StringArray strings = 4; + } } -message PdmObjectSetterChunk -{ - oneof data - { - PdmObjectSetterRequest set_request = 1; - DoubleArray doubles = 2; - IntArray ints = 3; - StringArray strings = 4; - } +message DoubleArray { repeated double data = 1; } + +message IntArray { repeated int32 data = 1; } + +message StringArray { repeated string data = 1; } + +message PdmObjectGetterReply { + oneof data { + DoubleArray doubles = 1; + IntArray ints = 2; + StringArray strings = 3; + } } - -message DoubleArray -{ - repeated double data = 1; -} - -message IntArray -{ - repeated int32 data = 1; -} - -message StringArray -{ - repeated string data = 1; -} - -message PdmObjectGetterReply -{ - oneof data - { - DoubleArray doubles = 1; - IntArray ints = 2; - StringArray strings = 3; - } -} - -message PdmObjectMethodRequest -{ - PdmObject object = 1; - string method = 2; - PdmObject params = 3; +message PdmObjectMethodRequest { + PdmObject object = 1; + string method = 2; + PdmObject params = 3; } diff --git a/GrpcInterface/GrpcProtos/Properties.proto b/GrpcInterface/GrpcProtos/Properties.proto index 7fd61a15ad..eaa10aeec0 100644 --- a/GrpcInterface/GrpcProtos/Properties.proto +++ b/GrpcInterface/GrpcProtos/Properties.proto @@ -5,68 +5,56 @@ import "Case.proto"; package rips; -service Properties -{ - rpc GetAvailableProperties(AvailablePropertiesRequest) returns (AvailableProperties) {} - rpc GetActiveCellProperty(PropertyRequest) returns (stream PropertyChunk) {} - rpc GetSelectedCellProperty(PropertyRequest) returns (stream PropertyChunk) {} - rpc GetGridProperty(PropertyRequest) returns (stream PropertyChunk) {} - rpc SetActiveCellProperty(stream PropertyInputChunk) returns (ClientToServerStreamReply) {} - rpc SetGridProperty(stream PropertyInputChunk) returns (ClientToServerStreamReply) {} +service Properties { + rpc GetAvailableProperties(AvailablePropertiesRequest) + returns (AvailableProperties) {} + rpc GetActiveCellProperty(PropertyRequest) returns (stream PropertyChunk) {} + rpc GetSelectedCellProperty(PropertyRequest) returns (stream PropertyChunk) {} + rpc GetGridProperty(PropertyRequest) returns (stream PropertyChunk) {} + rpc SetActiveCellProperty(stream PropertyInputChunk) + returns (ClientToServerStreamReply) {} + rpc SetGridProperty(stream PropertyInputChunk) + returns (ClientToServerStreamReply) {} } -enum PropertyType -{ - DYNAMIC_NATIVE = 0; - STATIC_NATIVE = 1; - SOURSIMRL = 2; - GENERATED = 3; - INPUT_PROPERTY = 4; - FORMATION_NAMES = 5; - FLOW_DIAGNOSTICS = 6; - INJECTION_FLOODING = 7; - REMOVED = 8; - UNDEFINED = 999; +enum PropertyType { + DYNAMIC_NATIVE = 0; + STATIC_NATIVE = 1; + SOURSIMRL = 2; + GENERATED = 3; + INPUT_PROPERTY = 4; + FORMATION_NAMES = 5; + FLOW_DIAGNOSTICS = 6; + INJECTION_FLOODING = 7; + REMOVED = 8; + UNDEFINED = 999; } -message AvailablePropertiesRequest -{ - CaseRequest case_request = 1; - PropertyType property_type = 2; - PorosityModelType porosity_model = 3; +message AvailablePropertiesRequest { + CaseRequest case_request = 1; + PropertyType property_type = 2; + PorosityModelType porosity_model = 3; } -message AvailableProperties -{ - repeated string property_names = 1; +message AvailableProperties { repeated string property_names = 1; } + +message PropertyRequest { + CaseRequest case_request = 1; + PropertyType property_type = 2; + string property_name = 3; + int32 time_step = 4; + int32 grid_index = 5; + PorosityModelType porosity_model = 6; } -message PropertyRequest -{ - CaseRequest case_request = 1; - PropertyType property_type = 2; - string property_name = 3; - int32 time_step = 4; - int32 grid_index = 5; - PorosityModelType porosity_model = 6; +message TimeStep { int32 index = 1; } + +message PropertyInputChunk { + oneof ChunkType { + // Params needs to be sent in the first message + PropertyRequest params = 1; + PropertyChunk values = 2; + } } -message TimeStep -{ - int32 index = 1; -} - -message PropertyInputChunk -{ - oneof ChunkType - { - // Params needs to be sent in the first message - PropertyRequest params = 1; - PropertyChunk values = 2; - } -} - -message PropertyChunk -{ - repeated double values = 1; -} +message PropertyChunk { repeated double values = 1; } diff --git a/GrpcInterface/GrpcProtos/SimulationWell.proto b/GrpcInterface/GrpcProtos/SimulationWell.proto index 65821e128a..4cf3962470 100644 --- a/GrpcInterface/GrpcProtos/SimulationWell.proto +++ b/GrpcInterface/GrpcProtos/SimulationWell.proto @@ -4,34 +4,32 @@ import "Definitions.proto"; package rips; -service SimulationWell -{ - rpc GetSimulationWellStatus(SimulationWellRequest) returns (SimulationWellStatus) {} - rpc GetSimulationWellCells(SimulationWellRequest) returns (SimulationWellCellInfoArray) {} +service SimulationWell { + rpc GetSimulationWellStatus(SimulationWellRequest) + returns (SimulationWellStatus) {} + rpc GetSimulationWellCells(SimulationWellRequest) + returns (SimulationWellCellInfoArray) {} } message SimulationWellRequest { - int32 case_id = 1; + int32 case_id = 1; string well_name = 2; - int32 timestep = 3; + int32 timestep = 3; } -message SimulationWellStatus -{ +message SimulationWellStatus { string well_type = 1; - bool is_open = 2; + bool is_open = 2; } message SimulationWellCellInfo { - Vec3i ijk = 1; + Vec3i ijk = 1; int32 grid_index = 2; - bool is_open = 3; - int32 branch_id = 4; + bool is_open = 3; + int32 branch_id = 4; int32 segment_id = 5; } -message SimulationWellCellInfoArray -{ +message SimulationWellCellInfoArray { repeated SimulationWellCellInfo data = 1; } - diff --git a/GrpcInterface/RiaGrpcCallbacks.h b/GrpcInterface/RiaGrpcCallbacks.h index bb7254a15c..004c8eaca1 100644 --- a/GrpcInterface/RiaGrpcCallbacks.h +++ b/GrpcInterface/RiaGrpcCallbacks.h @@ -116,7 +116,7 @@ public: using ResponseWriterT = ServerAsyncResponseWriter; using MethodImplT = std::function; using MethodRequestT = std::function< - void( ServiceT&, ServerContext*, RequestT*, ResponseWriterT*, CompletionQueue*, ServerCompletionQueue*, void* )>; + void( ServiceT&, ServerContext*, RequestT*, ResponseWriterT*, CompletionQueue*, ServerCompletionQueue*, void* )>; RiaGrpcUnaryCallback( ServiceT* service, MethodImplT methodImpl, MethodRequestT methodRequest );