Skip to content

Commit bad8404

Browse files
Add support of common v2.3 ColumnBasedTable
Fix #368
1 parent 4b1e579 commit bad8404

22 files changed

Lines changed: 1270 additions & 54 deletions

cmake/FesapiJavaExample.java

Lines changed: 99 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ Licensed to the Apache Software Foundation (ASF) under one
3232
import com.f2i_consulting.fesapi.eml23__IndexableElement;
3333
import com.f2i_consulting.fesapi.eml23__LengthUom;
3434
import com.f2i_consulting.fesapi.eml23__MassPerLengthUom;
35+
import com.f2i_consulting.fesapi.eml23__QuantityClassKind;
3536
import com.f2i_consulting.fesapi.eml23__ReferencePointKind;
3637
import com.f2i_consulting.fesapi.eml23__WellStatus;
3738
import com.f2i_consulting.fesapi.fesapi;
@@ -52,6 +53,7 @@ Licensed to the Apache Software Foundation (ASF) under one
5253
import com.f2i_consulting.fesapi.common.EpcDocument;
5354
import com.f2i_consulting.fesapi.eml2.AbstractHdfProxy;
5455
import com.f2i_consulting.fesapi.eml2.AbstractLocal3dCrs;
56+
import com.f2i_consulting.fesapi.eml2.ColumnBasedTable;
5557
import com.f2i_consulting.fesapi.eml2.GraphicalInformationSet;
5658
import com.f2i_consulting.fesapi.eml2.PropertyKind;
5759
import com.f2i_consulting.fesapi.eml2_3.Eml23_LocalEngineeringCompoundCrs;
@@ -655,6 +657,84 @@ private static void serializeGraphicalInformationSet(DataObjectRepository repo,
655657
graphicalInformationSet.setContinuousColorMap(contColMapContProp, contColMap);
656658
}
657659
${COMMENT_END}
660+
private static void serializeColumnBasedTable(DataObjectRepository repo)
661+
{
662+
ColumnBasedTable cbt = repo.createColumnBasedTable("866841eb-0c56-4b7d-96d6-f15f385deaf9", "KrPc");
663+
664+
PropertyKind pwls3Saturation = repo.createPropertyKind("cfe9293f-d5a9-486d-815a-a957cace90b6", "saturation", eml23__QuantityClassKind.dimensionless);
665+
PropertyKind pwls3RelPerm = repo.createPropertyKind("8e3c5579-7efd-40d0-ab03-bc79452dd2db", "relative permeability", eml23__QuantityClassKind.unitless);
666+
PropertyKind pwls3CapPressure = repo.createPropertyKind("a816a113-1544-4f58-bc6d-7c030b65627b", "capillary pressure", eml23__QuantityClassKind.pressure);
667+
668+
cbt.pushBackColumnHeader(true, "Water Saturation", pwls3Saturation);
669+
cbt.pushBackColumnHeader(false, "Water Relative Permeability", pwls3RelPerm);
670+
cbt.pushBackColumnHeader(false, "Oil Relative Permeability", pwls3RelPerm);
671+
cbt.pushBackColumnHeader(false, "Oil Water Capillary Pressure", pwls3CapPressure);
672+
673+
SWIGTYPE_p_double watSat = fesapi.new_DoubleArray(7);
674+
try {
675+
fesapi.DoubleArray_setitem(watSat, 0, 0);
676+
fesapi.DoubleArray_setitem(watSat, 1, 0.157);
677+
fesapi.DoubleArray_setitem(watSat, 2, 0.173);
678+
fesapi.DoubleArray_setitem(watSat, 3, 0.174325);
679+
fesapi.DoubleArray_setitem(watSat, 4, 0.19);
680+
fesapi.DoubleArray_setitem(watSat, 5, 0.19165);
681+
fesapi.DoubleArray_setitem(watSat, 6, 0.207);
682+
683+
cbt.setDoubleValues(0, watSat, 7);
684+
}
685+
finally {
686+
fesapi.delete_DoubleArray(watSat);
687+
}
688+
689+
SWIGTYPE_p_double watRelPerm = fesapi.new_DoubleArray(7);
690+
try {
691+
fesapi.DoubleArray_setitem(watRelPerm, 0, 0);
692+
fesapi.DoubleArray_setitem(watRelPerm, 1, 0);
693+
fesapi.DoubleArray_setitem(watRelPerm, 2, 0.000356);
694+
fesapi.DoubleArray_setitem(watRelPerm, 3, 0.0004392);
695+
fesapi.DoubleArray_setitem(watRelPerm, 4, 0.0014241);
696+
fesapi.DoubleArray_setitem(watRelPerm, 5, 0.0015969);
697+
fesapi.DoubleArray_setitem(watRelPerm, 6, 0.0032041);
698+
699+
cbt.setDoubleValues(1, watRelPerm, 7);
700+
}
701+
finally {
702+
fesapi.delete_DoubleArray(watRelPerm);
703+
}
704+
705+
SWIGTYPE_p_double oilRelPerm = fesapi.new_DoubleArray(7);
706+
try {
707+
fesapi.DoubleArray_setitem(oilRelPerm, 0, 1);
708+
fesapi.DoubleArray_setitem(oilRelPerm, 1, 0.99);
709+
fesapi.DoubleArray_setitem(oilRelPerm, 2, 0.886131);
710+
fesapi.DoubleArray_setitem(oilRelPerm, 3, 0.8767012);
711+
fesapi.DoubleArray_setitem(oilRelPerm, 4, 0.7764308);
712+
fesapi.DoubleArray_setitem(oilRelPerm, 5, 0.765876);
713+
fesapi.DoubleArray_setitem(oilRelPerm, 6, 0.6778755);
714+
715+
cbt.setDoubleValues(2, oilRelPerm, 7);
716+
}
717+
finally {
718+
fesapi.delete_DoubleArray(oilRelPerm);
719+
}
720+
721+
SWIGTYPE_p_double capPressure = fesapi.new_DoubleArray(7);
722+
try {
723+
fesapi.DoubleArray_setitem(capPressure, 0, 0);
724+
fesapi.DoubleArray_setitem(capPressure, 1, 0);
725+
fesapi.DoubleArray_setitem(capPressure, 2, 0);
726+
fesapi.DoubleArray_setitem(capPressure, 3, 0);
727+
fesapi.DoubleArray_setitem(capPressure, 4, 0);
728+
fesapi.DoubleArray_setitem(capPressure, 5, 0);
729+
fesapi.DoubleArray_setitem(capPressure, 6, 0);
730+
731+
cbt.setDoubleValues(3, capPressure, 7);
732+
}
733+
finally {
734+
fesapi.delete_DoubleArray(capPressure);
735+
}
736+
}
737+
658738
private static void serialize()
659739
{
660740
try (DataObjectRepository repo = new DataObjectRepository()) {
@@ -672,6 +752,7 @@ private static void serialize()
672752
${COMMENT_START}
673753
serializeGraphicalInformationSet(repo, hdfProxy);
674754
${COMMENT_END}
755+
serializeColumnBasedTable(repo);
675756

676757
EpcDocument pck = new EpcDocument(storageDirectory + File.separator + epcName + ".epc");
677758
pck.serializeFrom(repo);
@@ -800,7 +881,8 @@ private static void deserialize()
800881
}
801882
}
802883
}
803-
${COMMENT_END}
884+
${COMMENT_END}
885+
deserializeColumnBasedTable(repo);
804886
}
805887
}
806888

@@ -921,6 +1003,22 @@ private static void deserializeIjkGrid(DataObjectRepository repo) {
9211003
}
9221004
}
9231005

1006+
private static void deserializeColumnBasedTable(DataObjectRepository repo) {
1007+
System.out.println("COLUMN BASED TABLE");
1008+
long cbtCount = repo.getColumnBasedTableCount();
1009+
for (long cbtIdx = 0; cbtIdx < cbtCount; ++cbtIdx) {
1010+
ColumnBasedTable cbt = repo.getColumnBasedTable(cbtIdx);
1011+
System.out.println("\tCOLUMN BASED TABLE : " + cbt.getTitle());
1012+
for (long columnIdx = 0; columnIdx < cbt.getColumnCount(); ++columnIdx) {
1013+
System.out.println("\t\tPropKind : " + cbt.getPropertyKind(columnIdx).getTitle());
1014+
for (double dbl : cbt.getDoubleValues(columnIdx)) {
1015+
System.out.print(dbl + " ");
1016+
}
1017+
System.out.println();
1018+
}
1019+
}
1020+
}
1021+
9241022
public static void main(String[] args) {
9251023
serialize();
9261024
deserialize();

cmake/swigCsInclude.i

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ Basically this file add methods resqml2_0_instantiate* which will create the rig
3333
CHANNEL,
3434
CHANNELSET,
3535
CMPLINEFEATURE,
36+
COLUMNBASEDTABLE,
3637
COMMENTPROPERTY,
3738
CONTINUOUSCOLORMAP,
3839
CONTINUOUSPROPERTY,
@@ -125,11 +126,9 @@ Basically this file add methods resqml2_0_instantiate* which will create the rig
125126
if (xmlNs.Equals("resqml20")) {
126127
return new F2iConsulting.Fesapi.${FESAPI_RESQML2_0_1_NS}.Activity(cPtr, owner);
127128
}
128-
${COMMENT_START}
129129
else if (xmlNs.Equals("eml23")) {
130130
return new F2iConsulting.Fesapi.${FESAPI_EML2_3_NS}.Activity(cPtr, owner);
131131
}
132-
${COMMENT_END}
133132

134133
return null;
135134
}
@@ -140,11 +139,9 @@ ${COMMENT_END}
140139
if (xmlNs.Equals("resqml20")) {
141140
return new F2iConsulting.Fesapi.${FESAPI_RESQML2_0_1_NS}.ActivityTemplate(cPtr, owner);
142141
}
143-
${COMMENT_START}
144142
else if (xmlNs.Equals("eml23")) {
145143
return new F2iConsulting.Fesapi.${FESAPI_EML2_3_NS}.ActivityTemplate(cPtr, owner);
146144
}
147-
${COMMENT_END}
148145

149146
return null;
150147
}
@@ -160,11 +157,9 @@ ${COMMENT_END}
160157
if (xmlNs.Equals("resqml20")) {
161158
return new F2iConsulting.Fesapi.${FESAPI_RESQML2_0_1_NS}.PropertyKind(cPtr, owner);
162159
}
163-
${COMMENT_START}
164160
else if (xmlNs.Equals("eml23")) {
165161
return new F2iConsulting.Fesapi.${FESAPI_EML2_3_NS}.PropertyKind(cPtr, owner);
166162
}
167-
${COMMENT_END}
168163

169164
return null;
170165
}
@@ -175,11 +170,9 @@ ${COMMENT_END}
175170
if (xmlNs.Equals("resqml20")) {
176171
return new F2iConsulting.Fesapi.${FESAPI_RESQML2_0_1_NS}.TimeSeries(cPtr, owner);
177172
}
178-
${COMMENT_START}
179173
else if (xmlNs.Equals("eml23")) {
180174
return new F2iConsulting.Fesapi.${FESAPI_EML2_3_NS}.TimeSeries(cPtr, owner);
181175
}
182-
${COMMENT_END}
183176

184177
return null;
185178
}
@@ -867,6 +860,7 @@ ${COMMENT_END}
867860
${COMMENT_START}
868861
case DataObjectName.CMPLINEFEATURE : return new F2iConsulting.Fesapi.${FESAPI_RESQML2_2_NS}.CmpLineFeature(cPtr, owner);
869862
${COMMENT_END}
863+
case DataObjectName.COLUMNBASEDTABLE : return new F2iConsulting.Fesapi.${FESAPI_EML2_3_NS}.ColumnBasedTable(cPtr, owner);
870864
case DataObjectName.COMMENTPROPERTY : return resqml2_instantiateCommentProperty(cPtr, owner);
871865
${COMMENT_START}
872866
case DataObjectName.CONTINUOUSCOLORMAP : return new F2iConsulting.Fesapi.${FESAPI_RESQML2_2_NS}.ContinuousColorMap(cPtr, owner);
@@ -983,8 +977,7 @@ namespace COMMON_NS
983977

984978
namespace EML2_NS
985979
{
986-
%typemap(csout, excode=SWIGEXCODE) Activity*, ActivityTemplate*, EpcExternalPartReference*, PropertyKind*, TimeSeries*, AbstractLocal3dCrs*
987-
,GraphicalInformationSet*
980+
%typemap(csout, excode=SWIGEXCODE) Activity*, ActivityTemplate*, EpcExternalPartReference*, PropertyKind*, TimeSeries*, AbstractLocal3dCrs*, GraphicalInformationSet*, ColumnBasedTable*
988981
{
989982
global::System.IntPtr cPtr = $imcall;
990983
$csclassname ret = ($csclassname) $modulePINVOKE.eml2_instantiateConcreteObject(cPtr, $owner);$excode

cmake/swigJavaInclude.i

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ Basically this file add methods resqml2_0_instantiate* which will create the rig
3333
CHANNEL,
3434
CHANNELSET,
3535
CMPLINEFEATURE,
36+
COLUMNBASEDTABLE,
3637
COMMENTPROPERTY,
3738
CONTINUOUSCOLORMAP,
3839
CONTINUOUSPROPERTY,
@@ -125,11 +126,9 @@ Basically this file add methods resqml2_0_instantiate* which will create the rig
125126
if ("resqml20".equals(xmlNs)) {
126127
return new com.f2i_consulting.fesapi.${FESAPI_RESQML2_0_1_NS}.Resqml20_Activity(cPtr, owner);
127128
}
128-
${COMMENT_START}
129129
else if ("eml23".equals(xmlNs)) {
130130
return new com.f2i_consulting.fesapi.${FESAPI_EML2_3_NS}.Eml23_Activity(cPtr, owner);
131131
}
132-
${COMMENT_END}
133132

134133
return null;
135134
}
@@ -140,11 +139,9 @@ ${COMMENT_END}
140139
if ("resqml20".equals(xmlNs)) {
141140
return new com.f2i_consulting.fesapi.${FESAPI_RESQML2_0_1_NS}.Resqml20_ActivityTemplate(cPtr, owner);
142141
}
143-
${COMMENT_START}
144142
else if ("eml23".equals(xmlNs)) {
145143
return new com.f2i_consulting.fesapi.${FESAPI_EML2_3_NS}.Eml23_ActivityTemplate(cPtr, owner);
146144
}
147-
${COMMENT_END}
148145

149146
return null;
150147
}
@@ -160,11 +157,9 @@ ${COMMENT_END}
160157
if ("resqml20".equals(xmlNs)) {
161158
return new com.f2i_consulting.fesapi.${FESAPI_RESQML2_0_1_NS}.Resqml20_PropertyKind(cPtr, owner);
162159
}
163-
${COMMENT_START}
164160
else if ("eml23".equals(xmlNs)) {
165161
return new com.f2i_consulting.fesapi.${FESAPI_EML2_3_NS}.Eml23_PropertyKind(cPtr, owner);
166162
}
167-
${COMMENT_END}
168163

169164
return null;
170165
}
@@ -175,11 +170,9 @@ ${COMMENT_END}
175170
if ("resqml20".equals(xmlNs)) {
176171
return new com.f2i_consulting.fesapi.${FESAPI_RESQML2_0_1_NS}.Resqml20_TimeSeries(cPtr, owner);
177172
}
178-
${COMMENT_START}
179173
else if ("eml23".equals(xmlNs)) {
180174
return new com.f2i_consulting.fesapi.${FESAPI_EML2_3_NS}.Eml23_TimeSeries(cPtr, owner);
181175
}
182-
${COMMENT_END}
183176

184177
return null;
185178
}
@@ -867,6 +860,7 @@ ${COMMENT_END}
867860
${COMMENT_START}
868861
case CMPLINEFEATURE : return new com.f2i_consulting.fesapi.${FESAPI_RESQML2_2_NS}.Resqml22_CmpLineFeature(cPtr, owner);
869862
${COMMENT_END}
863+
case COLUMNBASEDTABLE : return new com.f2i_consulting.fesapi.${FESAPI_EML2_3_NS}.Eml23_ColumnBasedTable(cPtr, owner);
870864
case COMMENTPROPERTY : return resqml2_instantiateCommentProperty(cPtr, owner);
871865
${COMMENT_START}
872866
case CONTINUOUSCOLORMAP : return new com.f2i_consulting.fesapi.${FESAPI_RESQML2_2_NS}.Resqml22_ContinuousColorMap(cPtr, owner);
@@ -987,8 +981,7 @@ namespace COMMON_NS
987981

988982
namespace EML2_NS
989983
{
990-
%typemap(javaout) Activity*, ActivityTemplate*, EpcExternalPartReference*, PropertyKind*, TimeSeries*, AbstractLocal3dCrs*
991-
,GraphicalInformationSet*
984+
%typemap(javaout) Activity*, ActivityTemplate*, EpcExternalPartReference*, PropertyKind*, TimeSeries*, AbstractLocal3dCrs*, GraphicalInformationSet*, ColumnBasedTable*
992985
{
993986
long cPtr = $jnicall;
994987
$javaclassname ret = ($javaclassname) fesapiJNI.eml2_instantiateConcreteObject(cPtr, $owner);

cmake/swigPythonInclude.i.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ namespace EML2_NS
6363
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), outtype, 0);
6464
}
6565

66-
%typemap(out) Activity*, ActivityTemplate*, PropertyKind*, TimeSeries*
66+
%typemap(out) Activity*, ActivityTemplate*, PropertyKind*, TimeSeries*, ColumnBasedTable*
6767
#ifdef WITH_RESQML2_2
6868
,GraphicalInformationSet*
6969
#endif

example/example.cpp

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ under the License.
4242
#include "eml2/PropertyKind.h"
4343
#include "eml2/TimeSeries.h"
4444

45+
#include "eml2_3/ColumnBasedTable.h"
46+
#include "eml2_3/GraphicalInformationSet.h"
4547
#include "eml2_3/LocalEngineeringCompoundCrs.h"
4648
#include "eml2_3/PropertyKind.h"
4749

@@ -106,7 +108,6 @@ under the License.
106108
#include "resqml2_0_1/WellboreMarkerFrameRepresentation.h"
107109

108110
#if WITH_RESQML2_2
109-
#include "eml2_3/GraphicalInformationSet.h"
110111
#include "resqml2_2/DiscreteColorMap.h"
111112
#include "resqml2_2/ContinuousColorMap.h"
112113
#include "resqml2_2/FluidBoundaryInterpretation.h"
@@ -265,6 +266,29 @@ void serializeWitsmlWells(COMMON_NS::DataObjectRepository * repo)
265266
witsmlWellboreMarker->setDipDirection(10, gsoap_eml2_3::eml23__PlaneAngleUom::dega);
266267
}
267268

269+
void serializeColumnBasedTable(COMMON_NS::DataObjectRepository* repo, EML2_NS::AbstractHdfProxy* hdfProxy)
270+
{
271+
auto* cbt = repo->createColumnBasedTable("866841eb-0c56-4b7d-96d6-f15f385deaf9", "KrPc");
272+
273+
auto* pwls3Saturation = repo->createPropertyKind("cfe9293f-d5a9-486d-815a-a957cace90b6", "saturation", gsoap_eml2_3::eml23__QuantityClassKind::dimensionless);
274+
auto* pwls3RelPerm = repo->createPropertyKind("8e3c5579-7efd-40d0-ab03-bc79452dd2db", "relative permeability", gsoap_eml2_3::eml23__QuantityClassKind::unitless);
275+
auto* pwls3CapPressure = repo->createPropertyKind("a816a113-1544-4f58-bc6d-7c030b65627b", "capillary pressure", gsoap_eml2_3::eml23__QuantityClassKind::pressure);
276+
277+
cbt->pushBackColumnHeader(true, "Water Saturation", pwls3Saturation);
278+
cbt->pushBackColumnHeader(false, "Water Relative Permeability", pwls3RelPerm);
279+
cbt->pushBackColumnHeader(false, "Oil Relative Permeability", pwls3RelPerm);
280+
cbt->pushBackColumnHeader(false, "Oil Water Capillary Pressure", pwls3CapPressure);
281+
282+
double watSat[] = { 0, 0.157, 0.173, 0.174325, 0.19, 0.19165, 0.207 };
283+
cbt->setDoubleValues(0, watSat, 7);
284+
double watRelPerm[] = { 0, 0, 0.000356, 0.0004392, 0.0014241, 0.0015969, 0.0032041 };
285+
cbt->setDoubleValues(1, watRelPerm, 7);
286+
double oilRelPerm[] = { 1, 0.99, 0.886131, 0.8767012, 0.7764308, 0.765876, 0.6778755 };
287+
cbt->setDoubleValues(2, oilRelPerm, 7);
288+
double capPressure[] = { 0, 0, 0, 0, 0, 0, 0 };
289+
cbt->setDoubleValues(3, capPressure, 7);
290+
}
291+
268292
void serializeWells(COMMON_NS::DataObjectRepository * repo, EML2_NS::AbstractHdfProxy* hdfProxy)
269293
{
270294
serializeWitsmlWells(repo);
@@ -2539,6 +2563,7 @@ bool serialize(const string& filePath)
25392563
repo.setDefaultCrs(local3dCrs);
25402564

25412565
// Comment or uncomment below domains/lines you want wether to test or not
2566+
serializeColumnBasedTable(&repo, hdfProxy);
25422567
serializeWells(&repo, hdfProxy);
25432568
serializePerforations(&repo);
25442569
serializeBoundaries(&repo, hdfProxy);
@@ -2965,7 +2990,24 @@ void deserializeSealedVolumeFramework(const COMMON_NS::DataObjectRepository & re
29652990
showAllMetadata(svf->getRepOfExternalShellFace(regionIdx, faceIdx));
29662991
}
29672992
}
2993+
}
2994+
}
29682995

2996+
void deserializeColumnBasedTable(COMMON_NS::DataObjectRepository* repo)
2997+
{
2998+
for (auto const* cbt : repo->getColumnBasedTableSet()) {
2999+
cout << "COLUMN BASED TABLE : " << cbt->getTitle() << endl;
3000+
for (size_t columnIdx = 0; columnIdx < cbt->getColumnCount(); ++columnIdx) {
3001+
cout << "PropKind : " << cbt->getPropertyKind(columnIdx)->getTitle() << endl;
3002+
auto datatype = cbt->getDatatype(columnIdx);
3003+
cout << "Datatype : " << (int)datatype << endl;
3004+
if (datatype == COMMON_NS::AbstractObject::numericalDatatypeEnum::DOUBLE) {
3005+
for (double dbl : cbt->getDoubleValues(columnIdx)) {
3006+
cout << dbl << " ";
3007+
}
3008+
cout << endl;
3009+
}
3010+
}
29693011
}
29703012
}
29713013

@@ -5214,6 +5256,7 @@ void deserialize(const string & inputFile)
52145256
}
52155257
cout << endl;
52165258

5259+
deserializeColumnBasedTable(&repo);
52175260
deserializeGeobody(&repo);
52185261
deserializeFluidBoundary(repo);
52195262
deserializeRockFluidOrganization(repo);

0 commit comments

Comments
 (0)