Fesapi 2.3.0.0
This project provides C++ classes which allow an easy access in import and export to the Energistics standards.
AbstractIjkGridRepresentation.h
1/*-----------------------------------------------------------------------
2Licensed to the Apache Software Foundation (ASF) under one
3or more contributor license agreements. See the NOTICE file
4distributed with this work for additional information
5regarding copyright ownership. The ASF licenses this file
6to you under the Apache License, Version 2.0 (the
7"License"; you may not use this file except in compliance
8with the License. You may obtain a copy of the License at
9
10 http://www.apache.org/licenses/LICENSE-2.0
11
12Unless required by applicable law or agreed to in writing,
13software distributed under the License is distributed on an
14"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15KIND, either express or implied. See the License for the
16specific language governing permissions and limitations
17under the License.
18-----------------------------------------------------------------------*/
19#pragma once
20
21#include "AbstractColumnLayerGridRepresentation.h"
22
23#include <stdexcept>
24#include <map>
25
26namespace RESQML2_NS
27{
33 class AbstractIjkGridRepresentation : public RESQML2_NS::AbstractColumnLayerGridRepresentation
34 {
35 public:
36
38 enum geometryKind { UNKNOWN = 0, EXPLICIT = 1, PARAMETRIC = 2, LATTICE = 3, NO_GEOMETRY = 4}; // UNKNOWN exists in case of partial transfer
39
63 AbstractIjkGridRepresentation(COMMON_NS::DataObjectRepository * repo,
64 const std::string & guid, const std::string & title,
65 unsigned int iCount, unsigned int jCount, unsigned int kCount, bool* kGaps = nullptr, EML2_NS::AbstractHdfProxy* proxy = nullptr);
66
88 AbstractIjkGridRepresentation(RESQML2_NS::AbstractFeatureInterpretation* interp,
89 const std::string & guid, const std::string & title,
90 unsigned int iCount, unsigned int jCount, unsigned int kCount, bool* kGaps = nullptr, EML2_NS::AbstractHdfProxy* proxy = nullptr);
91
115 /*
116 AbstractIjkGridRepresentation(COMMON_NS::DataObjectRepository * repo,
117 const std::string & guid, const std::string & title,
118 unsigned int iCount, unsigned int jCount, unsigned int kCount,
119 unsigned int truncationNodeCount, unsigned int truncationFaceCount, unsigned int truncationCellCount);
120 */
138 /*
139 AbstractIjkGridRepresentation(RESQML2_NS::AbstractFeatureInterpretation* interp,
140 const std::string & guid, const std::string & title,
141 unsigned int iCount, unsigned int jCount, unsigned int kCount,
142 unsigned int truncationNodeCount, unsigned int truncationFaceCount, unsigned int truncationCellCount);
143 */
150 DLL_IMPORT_OR_EXPORT AbstractIjkGridRepresentation(gsoap_resqml2_0_1::eml20__DataObjectReference* partialObject, bool withTruncatedPillars = false);
151
153 DLL_IMPORT_OR_EXPORT virtual ~AbstractIjkGridRepresentation()
154 {
155 if (blockInformation != nullptr)
156 delete blockInformation;
157 }
158
167 DLL_IMPORT_OR_EXPORT unsigned int getICellCount() const;
168
176 DLL_IMPORT_OR_EXPORT void setICellCount(unsigned int iCount);
177
186 DLL_IMPORT_OR_EXPORT unsigned int getJCellCount() const;
187
195 DLL_IMPORT_OR_EXPORT void setJCellCount(unsigned int jCount);
196
205 DLL_IMPORT_OR_EXPORT uint64_t getCellCount() const final { return getICellCount() * getJCellCount() * getKCellCount(); }
206
216 DLL_IMPORT_OR_EXPORT unsigned int getColumnCount() const { return getICellCount() * getJCellCount(); }
217
227 DLL_IMPORT_OR_EXPORT unsigned int getPillarCount() const { return (getICellCount()+1) * (getJCellCount()+1); }
228
238 DLL_IMPORT_OR_EXPORT unsigned int getKGapsCount() const;
239
248 DLL_IMPORT_OR_EXPORT void getKGaps(bool * kGaps) const;
249
261 DLL_IMPORT_OR_EXPORT unsigned int getFaceCount() const;
262
279 DLL_IMPORT_OR_EXPORT unsigned int getIPillarFromGlobalIndex(unsigned int globalIndex) const;
280
297 DLL_IMPORT_OR_EXPORT unsigned int getJPillarFromGlobalIndex(unsigned int globalIndex) const;
298
316 DLL_IMPORT_OR_EXPORT unsigned int getGlobalIndexPillarFromIjIndex(unsigned int iPillar, unsigned int jPillar) const;
317
334 DLL_IMPORT_OR_EXPORT unsigned int getIColumnFromGlobalIndex(unsigned int globalIndex) const;
335
352 DLL_IMPORT_OR_EXPORT unsigned int getJColumnFromGlobalIndex(unsigned int globalIndex) const;
353
371 DLL_IMPORT_OR_EXPORT unsigned int getGlobalIndexColumnFromIjIndex(unsigned int iColumn, unsigned int jColumn) const;
372
389 DLL_IMPORT_OR_EXPORT unsigned int getGlobalIndexCellFromIjkIndex(unsigned int iCell, unsigned int jCell, unsigned int kCell) const;
390
400 DLL_IMPORT_OR_EXPORT bool isRightHanded() const;
401
419 DLL_IMPORT_OR_EXPORT void getPillarsOfSplitCoordinateLines(unsigned int * pillarIndices, bool reverseIAxis = false, bool reverseJAxis = false) const;
420
439 DLL_IMPORT_OR_EXPORT void getColumnsOfSplitCoordinateLines(unsigned int * columnIndices, bool reverseIAxis = false, bool reverseJAxis = false) const;
440
456 DLL_IMPORT_OR_EXPORT void getColumnCountOfSplitCoordinateLines(unsigned int * columnIndexCountPerSplitCoordinateLine) const;
457
467 DLL_IMPORT_OR_EXPORT unsigned long getSplitCoordinateLineCount() const;
468
477 DLL_IMPORT_OR_EXPORT unsigned long getBlockSplitCoordinateLineCount() const;
478
486 DLL_IMPORT_OR_EXPORT uint64_t getSplitNodeCount() const;
487
506 DLL_IMPORT_OR_EXPORT void getPillarGeometryIsDefined(bool * pillarGeometryIsDefined, bool reverseIAxis = false, bool reverseJAxis = false) const;
507
515 DLL_IMPORT_OR_EXPORT bool hasCellGeometryIsDefinedFlags() const;
516
536 DLL_IMPORT_OR_EXPORT void getCellGeometryIsDefinedFlags(bool* cellGeometryIsDefinedFlags, bool reverseIAxis = false, bool reverseJAxis= false, bool reverseKAxis= false) const;
537
556 DLL_IMPORT_OR_EXPORT void setCellGeometryIsDefinedFlags(unsigned char* cellGeometryIsDefinedFlags, EML2_NS::AbstractHdfProxy* proxy = nullptr);
557
563 DLL_IMPORT_OR_EXPORT void setAllCellGeometryFlagsToDefined();
564
569 DLL_IMPORT_OR_EXPORT void loadSplitInformation();
570
598 DLL_IMPORT_OR_EXPORT void loadBlockInformation(unsigned int iInterfaceStart, unsigned int iInterfaceEnd, unsigned int jInterfaceStart, unsigned int jInterfaceEnd, unsigned int kInterfaceStart, unsigned int kInterfaceEnd);
599
601 DLL_IMPORT_OR_EXPORT void unloadSplitInformation();
602
621 DLL_IMPORT_OR_EXPORT bool isColumnEdgeSplitted(unsigned int iColumn, unsigned int jColumn, unsigned int edge) const;
622
643 DLL_IMPORT_OR_EXPORT uint64_t getXyzPointIndexFromCellCorner(unsigned int iCell, unsigned int jCell, unsigned int kCell, unsigned int corner) const;
644
668 DLL_IMPORT_OR_EXPORT void getXyzPointOfBlockFromCellCorner(unsigned int iCell, unsigned int jCell, unsigned int kCell, unsigned int corner,
669 const double* xyzPoints, double & x, double & y, double & z) const;
670
683 DLL_IMPORT_OR_EXPORT uint64_t getXyzPointCountOfKInterface() const;
684
692 DLL_IMPORT_OR_EXPORT uint64_t getXyzPointCountOfBlock() const;
693
694 /*
695 * Gets all the XYZ points of a particular K interface. XYZ points are given in the local CRS.
696 * This method is not const since it is optimized in order not to recompute the pillar
697 * information but to get it as input.
698 *
699 * @param kInterface The K interface index starting from zero to kCellCount.
700 * @param [out] xyzPoints A linearized 2d array where the first (quickest) dimension is
701 * coordinate dimension (XYZ) and second dimension is vertex
702 * dimension. It must be pre allocated with a size of
703 * <tt>3 * getXyzPointCountOfKInterface()</tt>.
704 */
705 DLL_IMPORT_OR_EXPORT void getXyzPointsOfKInterface(unsigned int kInterface, double * xyzPoints);
706
726 DLL_IMPORT_OR_EXPORT virtual void getXyzPointsOfKInterfaceSequence(unsigned int kInterfaceStart, unsigned int kInterfaceEnd, double * xyzPoints);
727
740 DLL_IMPORT_OR_EXPORT virtual void getXyzPointsOfBlock(double * xyzPoints);
741
749 DLL_IMPORT_OR_EXPORT virtual bool isNodeGeometryCompressed() const { return false; }
750
751 DLL_IMPORT_OR_EXPORT gsoap_resqml2_0_1::resqml20__KDirection getKDirection() const override;
752
758 DLL_IMPORT_OR_EXPORT virtual geometryKind getGeometryKind() const { return UNKNOWN; }
759
760 virtual COMMON_NS::DataObjectReference getHdfProxyDor() const override { throw std::logic_error("Partial object"); }
761
762 DLL_IMPORT_OR_EXPORT virtual uint64_t getXyzPointCountOfPatch(unsigned int patchIndex) const override;
763
774 DLL_IMPORT_OR_EXPORT virtual void getXyzPointsOfPatch(unsigned int patchIndex, double * xyzPoints) const override;
775
777 DLL_IMPORT_OR_EXPORT static const char* XML_TAG;
778
780 DLL_IMPORT_OR_EXPORT static const char* XML_TAG_TRUNCATED;
781
782 DLL_IMPORT_OR_EXPORT std::string getXmlTag() const final;
783
784 DLL_IMPORT_OR_EXPORT unsigned int getPatchCount() const override {return 1;}
785
789 DLL_IMPORT_OR_EXPORT virtual std::string getXmlNamespace() const override {
790 if (gsoapProxy2_0_1 != nullptr) { return "resqml20"; }
791 if (gsoapProxy2_3 != nullptr) { return "resqml22"; }
792
793
794 if (partialObject != nullptr) {
795 if (partialObject->ContentType.find("x-resqml+xml;version=2.0") != std::string::npos) { return "resqml20"; }
796 if (partialObject->ContentType.find("x-resqml+xml;version=2.2") != std::string::npos) { return "resqml22"; }
797 }
798
799 throw std::logic_error("Cannot infer what is the Energistics namespace of this instance.");
800 }
801
802 protected:
803
809 AbstractIjkGridRepresentation(gsoap_resqml2_0_1::_resqml20__IjkGridRepresentation* fromGsoap) : AbstractColumnLayerGridRepresentation(fromGsoap, false), splitInformation(nullptr), kCellIndexWithGapLayer(nullptr), blockInformation(nullptr) {}
810
816 AbstractIjkGridRepresentation(gsoap_resqml2_0_1::_resqml20__TruncatedIjkGridRepresentation* fromGsoap) : AbstractColumnLayerGridRepresentation(fromGsoap, true), splitInformation(nullptr), kCellIndexWithGapLayer(nullptr), blockInformation(nullptr) {}
817 AbstractIjkGridRepresentation(gsoap_eml2_3::_resqml22__IjkGridRepresentation* fromGsoap) : AbstractColumnLayerGridRepresentation(fromGsoap, false), splitInformation(nullptr), kCellIndexWithGapLayer(nullptr), blockInformation(nullptr) {}
818 AbstractIjkGridRepresentation(gsoap_eml2_3::_resqml22__TruncatedIjkGridRepresentation* fromGsoap) : AbstractColumnLayerGridRepresentation(fromGsoap, true), splitInformation(nullptr), kCellIndexWithGapLayer(nullptr), blockInformation(nullptr) {}
819
820 gsoap_resqml2_0_1::_resqml20__IjkGridRepresentation* getSpecializedGsoapProxy2_0_1() const;
821 gsoap_resqml2_0_1::_resqml20__TruncatedIjkGridRepresentation* getSpecializedTruncatedGsoapProxy2_0_1() const;
822 gsoap_eml2_3::_resqml22__IjkGridRepresentation* getSpecializedGsoapProxy2_2() const;
823 gsoap_eml2_3::_resqml22__TruncatedIjkGridRepresentation* getSpecializedTruncatedGsoapProxy2_2() const;
824
832 gsoap_resqml2_0_1::resqml20__PointGeometry* getPointGeometry2_0_1(unsigned int patchIndex) const final;
833 gsoap_eml2_3::resqml22__PointGeometry* getPointGeometry2_2(unsigned int patchIndex) const final;
834
854 std::vector< std::pair< unsigned int, std::vector<unsigned int> > >* splitInformation;
855
860 unsigned int* kCellIndexWithGapLayer;
861
863 class BlockInformation
864 {
865 public:
866
868 unsigned int iInterfaceStart;
870 unsigned int iInterfaceEnd;
872 unsigned int jInterfaceStart;
874 unsigned int jInterfaceEnd;
876 unsigned int kInterfaceStart;
878 unsigned int kInterfaceEnd;
879
881 std::map<unsigned int, unsigned int> globalToLocalSplitCoordinateLinesIndex;
882
884 BlockInformation() = default;
885
887 ~BlockInformation() = default;
888 };
889
891 BlockInformation* blockInformation;
892
893 private:
894
911 void init(COMMON_NS::DataObjectRepository * repo,
912 const std::string & guid, const std::string & title,
913 unsigned int iCount, unsigned int jCount, unsigned int kCount, bool* kGaps, EML2_NS::AbstractHdfProxy* proxy = nullptr);
914 };
915}
Proxy class for an abstract column layer grid representation.
Definition: AbstractColumnLayerGridRepresentation.h:27
Proxy class for an abstract IJK grid representation. This class is semantically abstract....
Definition: AbstractIjkGridRepresentation.h:34
void getPillarGeometryIsDefined(bool *pillarGeometryIsDefined, bool reverseIAxis=false, bool reverseJAxis=false) const
AbstractIjkGridRepresentation(common::DataObjectRepository *repo, const std::string &guid, const std::string &title, unsigned int iCount, unsigned int jCount, unsigned int kCount, bool *kGaps=nullptr, eml2::AbstractHdfProxy *proxy=nullptr)
unsigned int getIPillarFromGlobalIndex(unsigned int globalIndex) const
unsigned int getJPillarFromGlobalIndex(unsigned int globalIndex) const
geometryKind
Definition: AbstractIjkGridRepresentation.h:38
void setJCellCount(unsigned int jCount)
Sets the count of cells in the J direction.
void setICellCount(unsigned int iCount)
unsigned long getSplitCoordinateLineCount() const
static const char * XML_TAG
Definition: AbstractIjkGridRepresentation.h:777
gsoap_resqml2_0_1::resqml20__KDirection getKDirection() const override
virtual ~AbstractIjkGridRepresentation()
Definition: AbstractIjkGridRepresentation.h:153
virtual bool isNodeGeometryCompressed() const
Definition: AbstractIjkGridRepresentation.h:749
unsigned int getIColumnFromGlobalIndex(unsigned int globalIndex) const
unsigned int getJColumnFromGlobalIndex(unsigned int globalIndex) const
uint64_t getXyzPointIndexFromCellCorner(unsigned int iCell, unsigned int jCell, unsigned int kCell, unsigned int corner) const
Gets the XYZ point index in the HDF dataset from the corner of a cell. This method requires that you ...
bool isColumnEdgeSplitted(unsigned int iColumn, unsigned int jColumn, unsigned int edge) const
Checks either a given column edge is splitted or not. This method requires that you have already load...
void getColumnsOfSplitCoordinateLines(unsigned int *columnIndices, bool reverseIAxis=false, bool reverseJAxis=false) const
virtual geometryKind getGeometryKind() const
Definition: AbstractIjkGridRepresentation.h:758
std::string getXmlTag() const final
void loadBlockInformation(unsigned int iInterfaceStart, unsigned int iInterfaceEnd, unsigned int jInterfaceStart, unsigned int jInterfaceEnd, unsigned int kInterfaceStart, unsigned int kInterfaceEnd)
static const char * XML_TAG_TRUNCATED
Definition: AbstractIjkGridRepresentation.h:780
virtual void getXyzPointsOfKInterfaceSequence(unsigned int kInterfaceStart, unsigned int kInterfaceEnd, double *xyzPoints)
Gets all the XYZ points of a particular sequence of K interfaces. XYZ points are given in the local C...
void getXyzPointOfBlockFromCellCorner(unsigned int iCell, unsigned int jCell, unsigned int kCell, unsigned int corner, const double *xyzPoints, double &x, double &y, double &z) const
Gets the x, y and z values of the corner of a cell of a given block. This method requires that you ha...
virtual common::DataObjectReference getHdfProxyDor() const override
Gets the data object reference of the HDF proxy which is used for storing the numerical values of thi...
Definition: AbstractIjkGridRepresentation.h:760
AbstractIjkGridRepresentation(resqml2::AbstractFeatureInterpretation *interp, const std::string &guid, const std::string &title, unsigned int iCount, unsigned int jCount, unsigned int kCount, bool *kGaps=nullptr, eml2::AbstractHdfProxy *proxy=nullptr)
unsigned int getGlobalIndexColumnFromIjIndex(unsigned int iColumn, unsigned int jColumn) const
void getColumnCountOfSplitCoordinateLines(unsigned int *columnIndexCountPerSplitCoordinateLine) const
virtual std::string getXmlNamespace() const override
Definition: AbstractIjkGridRepresentation.h:789
unsigned int getGlobalIndexPillarFromIjIndex(unsigned int iPillar, unsigned int jPillar) const
virtual void getXyzPointsOfBlock(double *xyzPoints)
Gets all the XYZ points of the current block. XYZ points are given in the local CRS....
void setCellGeometryIsDefinedFlags(unsigned char *cellGeometryIsDefinedFlags, eml2::AbstractHdfProxy *proxy=nullptr)
unsigned int getPillarCount() const
Definition: AbstractIjkGridRepresentation.h:227
AbstractIjkGridRepresentation(gsoap_resqml2_0_1::eml20__DataObjectReference *partialObject, bool withTruncatedPillars=false)
void getCellGeometryIsDefinedFlags(bool *cellGeometryIsDefinedFlags, bool reverseIAxis=false, bool reverseJAxis=false, bool reverseKAxis=false) const
virtual void getXyzPointsOfPatch(unsigned int patchIndex, double *xyzPoints) const override
Gets all the xyz points of a particular patch of this representation. xyz points are given in the loc...
void getPillarsOfSplitCoordinateLines(unsigned int *pillarIndices, bool reverseIAxis=false, bool reverseJAxis=false) const
unsigned long getBlockSplitCoordinateLineCount() const
uint64_t getCellCount() const final
Definition: AbstractIjkGridRepresentation.h:205
void getKGaps(bool *kGaps) const
unsigned int getGlobalIndexCellFromIjkIndex(unsigned int iCell, unsigned int jCell, unsigned int kCell) const
unsigned int getColumnCount() const
Definition: AbstractIjkGridRepresentation.h:216
virtual uint64_t getXyzPointCountOfPatch(unsigned int patchIndex) const override