Fesapi  2.0.0.0
This project provides C++ classes which allow an easy access in import and export to the Energistics standards.
IjkGridParametricRepresentation.h
1 /*-----------------------------------------------------------------------
2 Licensed to the Apache Software Foundation (ASF) under one
3 or more contributor license agreements. See the NOTICE file
4 distributed with this work for additional information
5 regarding copyright ownership. The ASF licenses this file
6 to you under the Apache License, Version 2.0 (the
7 "License"; you may not use this file except in compliance
8 with the License. You may obtain a copy of the License at
9 
10  http://www.apache.org/licenses/LICENSE-2.0
11 
12 Unless required by applicable law or agreed to in writing,
13 software distributed under the License is distributed on an
14 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 KIND, either express or implied. See the License for the
16 specific language governing permissions and limitations
17 under the License.
18 -----------------------------------------------------------------------*/
19 #pragma once
20 
21 #include "AbstractIjkGridRepresentation.h"
22 
23 namespace RESQML2_NS
24 {
32  {
33  public:
37  DLL_IMPORT_OR_EXPORT virtual ~IjkGridParametricRepresentation() {
38  if (pillarInformation != nullptr)
39  delete pillarInformation;
40  }
41 
42  DLL_IMPORT_OR_EXPORT void getXyzPointsOfKInterfaceSequence(unsigned int kInterfaceStart, unsigned int kInterfaceEnd, double * xyzPoints) final;
43 
51  DLL_IMPORT_OR_EXPORT void getXyzPointsOfBlock(double * xyzPoints) final;
52 
64  DLL_IMPORT_OR_EXPORT virtual unsigned int getControlPointMaxCountPerPillar() const = 0;
65 
87  DLL_IMPORT_OR_EXPORT void getControlPoints(double * controlPoints, bool reverseIAxis = false, bool reverseJAxis= false, bool reverseKAxis= false) const;
88 
99  DLL_IMPORT_OR_EXPORT virtual bool hasControlPointParameters() const = 0;
100 
127  DLL_IMPORT_OR_EXPORT void getControlPointParameters(double * controlPointParameters, bool reverseIAxis = false, bool reverseJAxis= false, bool reverseKAxis= false) const;
128 
139  DLL_IMPORT_OR_EXPORT virtual bool isParametricLineKindConstant() const = 0;
140 
151  DLL_IMPORT_OR_EXPORT virtual short getConstantParametricLineKind() const = 0;
152 
171  DLL_IMPORT_OR_EXPORT void getParametricLineKind(short * pillarKind, bool reverseIAxis = false, bool reverseJAxis= false) const;
172 
192  DLL_IMPORT_OR_EXPORT void getParametersOfNodes(double * parameters, bool reverseIAxis = false, bool reverseJAxis= false, bool reverseKAxis= false) const;
193 
216  DLL_IMPORT_OR_EXPORT void getParametersOfNodesOfKInterfaceSequence(unsigned int kInterfaceStart, unsigned int kInterfaceEnd, double * parameters);
217 
262  gsoap_resqml2_0_1::resqml20__PillarShape mostComplexPillarGeometry, bool isRightHanded,
263  double const * parameters, double const * controlPoints, double const * controlPointParameters, unsigned int controlPointMaxCountPerPillar, short const * pillarKind,
264  EML2_NS::AbstractHdfProxy* proxy = nullptr, RESQML2_NS::AbstractLocal3dCrs * localCrs = nullptr);
265 
311  gsoap_resqml2_0_1::resqml20__PillarShape mostComplexPillarGeometry, gsoap_resqml2_0_1::resqml20__KDirection kDirectionKind, bool isRightHanded,
312  const std::string & parameters, const std::string & controlPoints, const std::string & controlPointParameters, unsigned int controlPointMaxCountPerPillar, const std::string & pillarKind, const std::string & definedPillars,
313  EML2_NS::AbstractHdfProxy* proxy = nullptr, RESQML2_NS::AbstractLocal3dCrs * localCrs = nullptr);
314 
380  DLL_IMPORT_OR_EXPORT virtual void setGeometryAsParametricSplittedPillarNodes(
381  gsoap_resqml2_0_1::resqml20__PillarShape mostComplexPillarGeometry, bool isRightHanded,
382  double const * parameters, double const * controlPoints, double const * controlPointParameters, unsigned int controlPointMaxCountPerPillar, short const * pillarKind, EML2_NS::AbstractHdfProxy* proxy,
383  unsigned long splitCoordinateLineCount, unsigned int const * pillarOfCoordinateLine,
384  unsigned int const * splitCoordinateLineColumnCumulativeCount, unsigned int const * splitCoordinateLineColumns, RESQML2_NS::AbstractLocal3dCrs * localCrs = nullptr) = 0;
385 
455  gsoap_resqml2_0_1::resqml20__PillarShape mostComplexPillarGeometry, gsoap_resqml2_0_1::resqml20__KDirection kDirectionKind, bool isRightHanded,
456  const std::string & parameters, const std::string & controlPoints, const std::string & controlPointParameters, unsigned int controlPointMaxCountPerPillar, const std::string & pillarKind, const std::string & definedPillars, EML2_NS::AbstractHdfProxy* proxy,
457  unsigned long splitCoordinateLineCount, const std::string & pillarOfCoordinateLine,
458  const std::string & splitCoordinateLineColumnCumulativeCount, const std::string & splitCoordinateLineColumns, RESQML2_NS::AbstractLocal3dCrs * localCrs = nullptr) = 0;
459 
523  DLL_IMPORT_OR_EXPORT void setGeometryAsParametricSplittedPillarNodes(bool isRightHanded,
524  double const * parameters, double const * controlPoints, double const * controlPointParameters, unsigned int controlPointCountPerPillar, short pillarKind, EML2_NS::AbstractHdfProxy* proxy,
525  unsigned long splitCoordinateLineCount, unsigned int const * pillarOfCoordinateLine,
526  unsigned int const * splitCoordinateLineColumnCumulativeCount, unsigned int const * splitCoordinateLineColumns, RESQML2_NS::AbstractLocal3dCrs * localCrs = nullptr);
527 
591  gsoap_resqml2_0_1::resqml20__KDirection kDirectionKind, bool isRightHanded,
592  const std::string & parameters, const std::string & controlPoints, const std::string & controlPointParameters, unsigned int controlPointCountPerPillar, short pillarKind, EML2_NS::AbstractHdfProxy* proxy,
593  unsigned long splitCoordinateLineCount, const std::string & pillarOfCoordinateLine,
594  const std::string & splitCoordinateLineColumnCumulativeCount, const std::string & splitCoordinateLineColumns, RESQML2_NS::AbstractLocal3dCrs * localCrs = nullptr) = 0;
595 
596  DLL_IMPORT_OR_EXPORT bool isNodeGeometryCompressed() const final;
597 
598  DLL_IMPORT_OR_EXPORT geometryKind getGeometryKind() const final;
599 
600  protected:
601  IjkGridParametricRepresentation(COMMON_NS::DataObjectRepository * repo,
602  const std::string & guid, const std::string & title,
603  unsigned int iCount, unsigned int jCount, unsigned int kCount, bool* kGaps = nullptr, EML2_NS::AbstractHdfProxy* proxy = nullptr) :
604  AbstractIjkGridRepresentation(repo, guid, title, iCount, jCount, kCount, kGaps, proxy), pillarInformation(nullptr) {}
605 
606  IjkGridParametricRepresentation(RESQML2_NS::AbstractFeatureInterpretation* interp,
607  const std::string & guid, const std::string & title,
608  unsigned int iCount, unsigned int jCount, unsigned int kCount, bool* kGaps = nullptr, EML2_NS::AbstractHdfProxy* proxy = nullptr) :
609  AbstractIjkGridRepresentation(interp, guid, title, iCount, jCount, kCount, kGaps, proxy), pillarInformation(nullptr) {}
610 
614  IjkGridParametricRepresentation(gsoap_resqml2_0_1::_resqml20__IjkGridRepresentation* fromGsoap) : AbstractIjkGridRepresentation(fromGsoap), pillarInformation(nullptr) {}
615  IjkGridParametricRepresentation(gsoap_eml2_3::_resqml22__IjkGridRepresentation* fromGsoap) : AbstractIjkGridRepresentation(fromGsoap), pillarInformation(nullptr) {}
616  IjkGridParametricRepresentation(gsoap_resqml2_0_1::_resqml20__TruncatedIjkGridRepresentation* fromGsoap) : AbstractIjkGridRepresentation(fromGsoap), pillarInformation(nullptr) {}
617  IjkGridParametricRepresentation(gsoap_eml2_3::_resqml22__TruncatedIjkGridRepresentation* fromGsoap) : AbstractIjkGridRepresentation(fromGsoap), pillarInformation(nullptr) {}
618 
622  gsoap_resqml2_0_1::resqml20__KDirection computeKDirection(double const * controlPoints, unsigned int controlPointCountPerPillar, short const * pillarKind, RESQML2_NS::AbstractLocal3dCrs const * localCrs);
623 
624  void writeGeometryOnHdf(double const * parameters,
625  double const * controlPoints, double const * controlPointParameters, unsigned int controlPointCountPerPillar,
626  unsigned long splitCoordinateLineCount, unsigned int const * pillarOfCoordinateLine,
627  unsigned int const * splitCoordinateLineColumnCumulativeCount, unsigned int const * splitCoordinateLineColumns, EML2_NS::AbstractHdfProxy * proxy);
628 
629  virtual EML2_NS::AbstractHdfProxy* getParameterDatasetPath(std::string & datasetPathInExternalFile) const = 0;
630  virtual EML2_NS::AbstractHdfProxy* getControlPointDatasetPath(std::string & datasetPathInExternalFile) const = 0;
631  virtual EML2_NS::AbstractHdfProxy* getControlPointParametersDatasetPath(std::string & datasetPathInExternalFile) const = 0;
632  virtual EML2_NS::AbstractHdfProxy* getParametersOfNodesDatasetPath(std::string & datasetPathInExternalFile) const = 0;
633  virtual void getRawParametricLineKind(short * pillarKind) const = 0;
634  void getXyzPointsFromParametricPoints(double * xyzPoints) const;
635 
636  private:
640  class BSpline
641  {
642  public:
643  BSpline() {};
644  BSpline(const std::vector<double> & parametersAtControlPoint, const std::vector<double> & valuesAtControlPoint);
645  ~BSpline() = default;
646 
647  double getValueFromParameter(double param) const;
648  void setParameterAndValueAtControlPoint(const std::vector<double> & parametersAtControlPoint, const std::vector<double> & valuesAtControlPoint);
649 
650  private:
651 
652  void checkIfParametersIncreaseOrDecrease();
653  std::size_t getSplineIndexFromParameter(double param) const;
654 
655  bool areParametersIncreasing;
656 
657  // basically each of set of 5 double describe a spline
658  std::vector<double> a;
659  std::vector<double> b;
660  std::vector<double> c;
661  std::vector<double> d;
662  std::vector<double> parameter; //named x in the wiki link
663 
664  };
665 
666  class PillarInformation
667  {
668  public:
669 
670  unsigned int maxControlPointCount;
671  unsigned int parametricLineCount;
672  unsigned int splitLineCount;
673  double * controlPoints;
674  double * controlPointParameters;
675  short * pillarKind;
676  unsigned int* pillarOfSplitCoordLines;
677  std::vector< std::vector< BSpline > > splines;
678 
679  PillarInformation() :maxControlPointCount(0), parametricLineCount(0), splitLineCount(0),
680  controlPoints(nullptr), controlPointParameters(nullptr), pillarKind(nullptr), pillarOfSplitCoordLines(nullptr) {}
681 
682  ~PillarInformation() {
683  cleanMemory();
684  }
685 
686  void cleanMemory() {
687  if (controlPoints != nullptr) delete[] controlPoints;
688  if (controlPointParameters != nullptr) delete[] controlPointParameters;
689  if (pillarKind != nullptr) delete[] pillarKind;
690  if (pillarOfSplitCoordLines != nullptr) delete[] pillarOfSplitCoordLines;
691  }
692  };
693 
698  void loadPillarInformation(PillarInformation & pillarInfo) const;
699 
700  class PillarInformation* pillarInformation;
701  };
702 }
Proxy class for an abstract IJK grid representation. This class is semantically abstract....
Definition: AbstractIjkGridRepresentation.h:34
geometryKind
Definition: AbstractIjkGridRepresentation.h:38
An IJK Grid parametric representation define the cell corner positions by means of parameters along t...
Definition: IjkGridParametricRepresentation.h:32
virtual bool isParametricLineKindConstant() const =0
virtual void setGeometryAsParametricSplittedPillarNodesUsingExistingDatasets(gsoap_resqml2_0_1::resqml20__PillarShape mostComplexPillarGeometry, gsoap_resqml2_0_1::resqml20__KDirection kDirectionKind, bool isRightHanded, const std::string &parameters, const std::string &controlPoints, const std::string &controlPointParameters, unsigned int controlPointMaxCountPerPillar, const std::string &pillarKind, const std::string &definedPillars, eml2::AbstractHdfProxy *proxy, unsigned long splitCoordinateLineCount, const std::string &pillarOfCoordinateLine, const std::string &splitCoordinateLineColumnCumulativeCount, const std::string &splitCoordinateLineColumns, resqml2::AbstractLocal3dCrs *localCrs=nullptr)=0
void getControlPoints(double *controlPoints, bool reverseIAxis=false, bool reverseJAxis=false, bool reverseKAxis=false) const
void setGeometryAsParametricNonSplittedPillarNodes(gsoap_resqml2_0_1::resqml20__PillarShape mostComplexPillarGeometry, bool isRightHanded, double const *parameters, double const *controlPoints, double const *controlPointParameters, unsigned int controlPointMaxCountPerPillar, short const *pillarKind, eml2::AbstractHdfProxy *proxy=nullptr, resqml2::AbstractLocal3dCrs *localCrs=nullptr)
void getControlPointParameters(double *controlPointParameters, bool reverseIAxis=false, bool reverseJAxis=false, bool reverseKAxis=false) const
void getXyzPointsOfBlock(double *xyzPoints) final
Gets all the XYZ points of the current block. XYZ points are given in the local CRS....
void getParametricLineKind(short *pillarKind, bool reverseIAxis=false, bool reverseJAxis=false) const
virtual void setGeometryAsParametricSplittedPillarNodes(gsoap_resqml2_0_1::resqml20__PillarShape mostComplexPillarGeometry, bool isRightHanded, double const *parameters, double const *controlPoints, double const *controlPointParameters, unsigned int controlPointMaxCountPerPillar, short const *pillarKind, eml2::AbstractHdfProxy *proxy, unsigned long splitCoordinateLineCount, unsigned int const *pillarOfCoordinateLine, unsigned int const *splitCoordinateLineColumnCumulativeCount, unsigned int const *splitCoordinateLineColumns, resqml2::AbstractLocal3dCrs *localCrs=nullptr)=0
void getParametersOfNodesOfKInterfaceSequence(unsigned int kInterfaceStart, unsigned int kInterfaceEnd, double *parameters)
void getParametersOfNodes(double *parameters, bool reverseIAxis=false, bool reverseJAxis=false, bool reverseKAxis=false) const
virtual ~IjkGridParametricRepresentation()
Definition: IjkGridParametricRepresentation.h:37
virtual short getConstantParametricLineKind() const =0
void setGeometryAsParametricSplittedPillarNodes(bool isRightHanded, double const *parameters, double const *controlPoints, double const *controlPointParameters, unsigned int controlPointCountPerPillar, short pillarKind, eml2::AbstractHdfProxy *proxy, unsigned long splitCoordinateLineCount, unsigned int const *pillarOfCoordinateLine, unsigned int const *splitCoordinateLineColumnCumulativeCount, unsigned int const *splitCoordinateLineColumns, resqml2::AbstractLocal3dCrs *localCrs=nullptr)
virtual void setGeometryAsParametricSplittedPillarNodesUsingExistingDatasets(gsoap_resqml2_0_1::resqml20__KDirection kDirectionKind, bool isRightHanded, const std::string &parameters, const std::string &controlPoints, const std::string &controlPointParameters, unsigned int controlPointCountPerPillar, short pillarKind, eml2::AbstractHdfProxy *proxy, unsigned long splitCoordinateLineCount, const std::string &pillarOfCoordinateLine, const std::string &splitCoordinateLineColumnCumulativeCount, const std::string &splitCoordinateLineColumns, resqml2::AbstractLocal3dCrs *localCrs=nullptr)=0
virtual unsigned int getControlPointMaxCountPerPillar() const =0
void getXyzPointsOfKInterfaceSequence(unsigned int kInterfaceStart, unsigned int kInterfaceEnd, double *xyzPoints) final
Gets all the XYZ points of a particular sequence of K interfaces. XYZ points are given in the local C...
void setGeometryAsParametricNonSplittedPillarNodesUsingExistingDatasets(gsoap_resqml2_0_1::resqml20__PillarShape mostComplexPillarGeometry, gsoap_resqml2_0_1::resqml20__KDirection kDirectionKind, bool isRightHanded, const std::string &parameters, const std::string &controlPoints, const std::string &controlPointParameters, unsigned int controlPointMaxCountPerPillar, const std::string &pillarKind, const std::string &definedPillars, eml2::AbstractHdfProxy *proxy=nullptr, resqml2::AbstractLocal3dCrs *localCrs=nullptr)
virtual bool hasControlPointParameters() const =0