Rewritten code generation:
With this commit the generation of built in keywords is completely
changed. The most important changes include:
1) We have autogenerated a class for each keyword in the new
ParserKeywords { ... } namespace.
2) The autogenerated classes derive from ParserKeyword, and the
default constructor will build of a fully initialized
ParserKeyword instance, i.e. the keyword used to parse the EQUIL
keyword can be instantiated as simple as:
ParserKeywords::EQUIL kw;
3) The generated keywords have built in static constants for keyword
and item names, and item default values. That way it should be
possible for the compiler to catch trivial errors like trying to
access the keyword "PoRO"; also the the access to default values
means that properties can be initialized without actually
insantiating a DeckKeyword.
4) Two new classes Generator/KeywordLoader and
Generator/KeywordGenerator have been created, with the help of
these classes the keyword generation code is significantly
simplified.
This commit is contained in:
3
testdata/parser/keyword-generator/PORO-invalid
vendored
Normal file
3
testdata/parser/keyword-generator/PORO-invalid
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{"name" : "PORO" , "sections" : ["GRID"], "data" : {"value_type" : "DOUBLE" , "default" : "XX" , "dimension":"1"}}
|
||||
|
||||
|
||||
3
testdata/parser/keyword-generator/PORO.json
vendored
Normal file
3
testdata/parser/keyword-generator/PORO.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{"name" : "PORO" , "sections" : ["GRID"], "data" : {"value_type" : "DOUBLE" , "default" : 0 , "dimension":"1"}}
|
||||
|
||||
|
||||
3
testdata/parser/keyword-generator/invalid.json
vendored
Normal file
3
testdata/parser/keyword-generator/invalid.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{"name" : "PORO" , "sections" : ["GRID"], "data" : {"value_type" : "DOUBLE" , "default" : 0 , "dimension":"1"}
|
||||
|
||||
|
||||
5
testdata/parser/keyword-generator/loader/001_ECLIPSE100/A/2ADDREG
vendored
Normal file
5
testdata/parser/keyword-generator/loader/001_ECLIPSE100/A/2ADDREG
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
{"name" : "ADDREG" , "sections" : ["GRID","EDIT","PROPS","REGIONS","SOLUTION"],
|
||||
"items" :
|
||||
[{"name" : "ARRAY" , "value_type" : "STRING" , "description" : "The 3D array we will update"},
|
||||
{"name" : "SHIFT" , "value_type" : "DOUBLE" , "description" : "The value we will multiply with" , "default" : 0} ,
|
||||
{"name" : "REGION_NAME" , "value_type" : "STRING" , "description" : "The name of the region we are interested in" , "default" : "M"}]}
|
||||
1
testdata/parser/keyword-generator/loader/001_ECLIPSE100/A/ACTNUM
vendored
Normal file
1
testdata/parser/keyword-generator/loader/001_ECLIPSE100/A/ACTNUM
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"name" : "ACTNUM", "sections" : ["GRID"], "data" : {"value_type" : "INT" }}
|
||||
5
testdata/parser/keyword-generator/loader/001_ECLIPSE100/A/ADDREG
vendored
Normal file
5
testdata/parser/keyword-generator/loader/001_ECLIPSE100/A/ADDREG
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
{"name" : "ADDREG" , "sections" : ["GRID","EDIT","PROPS","REGIONS","SOLUTION"],
|
||||
"items" :
|
||||
[{"name" : "ARRAY" , "value_type" : "STRING" , "description" : "The 3D array we will update"},
|
||||
{"name" : "SHIFT" , "value_type" : "DOUBLE" , "description" : "The value we will multiply with" , "default" : 0} ,
|
||||
{"name" : "REGION_NAME" , "value_type" : "STRING" , "description" : "The name of the region we are interested in" , "default" : "M"}]}
|
||||
145
testdata/parser/keyword-generator/loader/001_ECLIPSE100/B/BLOCK_PROBE
vendored
Normal file
145
testdata/parser/keyword-generator/loader/001_ECLIPSE100/B/BLOCK_PROBE
vendored
Normal file
@@ -0,0 +1,145 @@
|
||||
{
|
||||
"name" : "BLOCK_PROBE" ,
|
||||
"sections" : ["SUMMARY"],
|
||||
|
||||
"comment": "E100 only",
|
||||
"deck_names" : [
|
||||
"BOSAT",
|
||||
"BSOIL",
|
||||
"BOIP",
|
||||
"BOIPL",
|
||||
"BOIPG",
|
||||
"BPPO",
|
||||
"BVOIL",
|
||||
"BOVIS",
|
||||
"BDENO",
|
||||
"BODEN",
|
||||
"BFLOOI",
|
||||
"BFLOOJ",
|
||||
"BFLOOK",
|
||||
"BVELOI",
|
||||
"BVELOJ",
|
||||
"BVELOK",
|
||||
"BWSAT",
|
||||
"BSWAT",
|
||||
"BWIP",
|
||||
"BPPW",
|
||||
"BVWAT",
|
||||
"BWVIS",
|
||||
"BDENW",
|
||||
"BWDEN",
|
||||
"BFLOWI",
|
||||
"BVELWJ",
|
||||
"BVELWK",
|
||||
"BVELWI",
|
||||
"BVELWJ",
|
||||
"BVELWK",
|
||||
"BGSAT",
|
||||
"BSGAS",
|
||||
"BGIP",
|
||||
"BGIPL",
|
||||
"BGIPG",
|
||||
"BPPG",
|
||||
"BVGAS",
|
||||
"BGVIS",
|
||||
"BDENG",
|
||||
"BGDEN",
|
||||
"BFLOGI",
|
||||
"BFLOGJ",
|
||||
"BFLOGK",
|
||||
"BVELGI",
|
||||
"BVELGJ",
|
||||
"BVELGK",
|
||||
"BPR",
|
||||
"BWPR",
|
||||
"BGPR",
|
||||
"BRS",
|
||||
"BRV",
|
||||
"BPBUB",
|
||||
"BPDEW",
|
||||
"BRSSAT",
|
||||
"BRVSAT",
|
||||
"BSTATE",
|
||||
"BPPC",
|
||||
"BOKR",
|
||||
"BWKR",
|
||||
"BGKR",
|
||||
"BKRO",
|
||||
"BKRG",
|
||||
"BKRW",
|
||||
"BWPC",
|
||||
"BGPC",
|
||||
"BGTRP",
|
||||
"BGTPD",
|
||||
"BGSHY",
|
||||
"BGSTRP",
|
||||
"BWSHY",
|
||||
"BWSMA",
|
||||
"BHD",
|
||||
"BHDF",
|
||||
"BPR_X",
|
||||
"BHD_X",
|
||||
"BHDF_X",
|
||||
"BSCN_X",
|
||||
"BCTRA_X",
|
||||
"LBPR_X",
|
||||
"LBHD_X",
|
||||
"LBHDF_X",
|
||||
"LBSCN_X",
|
||||
"LBCTRA_X",
|
||||
"BRPV",
|
||||
"BOPV",
|
||||
"BWPV",
|
||||
"BGPV",
|
||||
"BHPV",
|
||||
"BRTM",
|
||||
"BPORVMOD",
|
||||
"BPERMMOD",
|
||||
"BAPI",
|
||||
"BSCN",
|
||||
"BSIP",
|
||||
"BEWV_SAL",
|
||||
"BTCNFANI",
|
||||
"BTCNFCAT",
|
||||
"BTRADCAT",
|
||||
"BTSADCAT",
|
||||
"BESALSUR",
|
||||
"BESALPLY",
|
||||
"BTCNFHEA",
|
||||
"BTIPTHEA",
|
||||
"BCGC",
|
||||
"BCSC",
|
||||
"BTCNFFOA",
|
||||
"BTCNMFOA",
|
||||
"BTIPTFOA",
|
||||
"BTADSFOA",
|
||||
"BTDCYFOA",
|
||||
"BTMOBFOA",
|
||||
"BTHLFFOA",
|
||||
"BGI",
|
||||
"BSIP",
|
||||
"BNSAT",
|
||||
"BNIP",
|
||||
"BNKR",
|
||||
"BTCNFSUR",
|
||||
"BTIPTSUR",
|
||||
"BTADSUR",
|
||||
"BTCASUR",
|
||||
"BTSTSUR",
|
||||
"BEWV_SUR",
|
||||
"BTCNFALK",
|
||||
"BTADSALK",
|
||||
"BTSTMALK",
|
||||
"BTSADALK",
|
||||
"BTPADALK"
|
||||
],
|
||||
|
||||
"comment":"Some keywords need to be suffixed by a tracer name...",
|
||||
"deck_name_regex":"BU.+|BTIPF.+|BTIPS.+|BTCNF.+|BTCNS.+|BTCN[1-9][0-9]*.+|BTIPT.+|BTIPF.+|BTIPS.+|BTIP[1-9][0-9]*.+|BTADS.+|BTDCY",
|
||||
|
||||
"items" : [
|
||||
{"name": "I" , "value_type" : "INT"},
|
||||
{"name": "J" , "value_type" : "INT"},
|
||||
{"name": "K" , "value_type" : "INT"}
|
||||
]
|
||||
}
|
||||
7
testdata/parser/keyword-generator/loader/001_ECLIPSE100/B/BOX
vendored
Normal file
7
testdata/parser/keyword-generator/loader/001_ECLIPSE100/B/BOX
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
{"name" : "BOX" , "sections" : ["GRID", "EDIT", "PROPS", "REGIONS", "SOLUTION", "SCHEDULE"], "size" : 1 , "items" : [
|
||||
{"name" : "I1" , "value_type" : "INT"},
|
||||
{"name" : "I2" , "value_type" : "INT"},
|
||||
{"name" : "J1" , "value_type" : "INT"},
|
||||
{"name" : "J2" , "value_type" : "INT"},
|
||||
{"name" : "K1" , "value_type" : "INT"},
|
||||
{"name" : "K2" , "value_type" : "INT"}]}
|
||||
6
testdata/parser/keyword-generator/loader/002_ECLIPSE300/ADDREG
vendored
Normal file
6
testdata/parser/keyword-generator/loader/002_ECLIPSE300/ADDREG
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
{"name" : "ADDREG" , "sections" : ["GRID","EDIT","PROPS","REGIONS","SOLUTION"],
|
||||
"items" :
|
||||
[{"name" : "ARRAY" , "value_type" : "STRING" , "description" : "The 3D array we will update"},
|
||||
{"name" : "SHIFT" , "value_type" : "DOUBLE" , "description" : "The value we will multiply with" , "default" : 0} ,
|
||||
{"name" : "REGION_NUMBER" , "value_type" : "INT" , "description" : "The region number we are interested in"} ,
|
||||
{"name" : "REGION_NAME" , "value_type" : "STRING" , "description" : "The name of the region we are interested in" , "default" : "M"}]}
|
||||
13
testdata/parser/keyword-generator/loader/002_ECLIPSE300/EQUIL
vendored
Normal file
13
testdata/parser/keyword-generator/loader/002_ECLIPSE300/EQUIL
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
{"name" : "EQUIL" , "sections" : ["SOLUTION"], "size" : {"keyword":"EQLDIMS" , "item":"NTEQUL"},
|
||||
"description": "The EQUIL item is used when equilibrationg the model. The item should consist of one record for each PVT region",
|
||||
"items" :
|
||||
[{"name" : "DATUM_DEPTH" , "value_type" : "DOUBLE" , "default" : 0.0 , "dimension" : "Length"},
|
||||
{"name" : "DATUM_PRESSURE" , "value_type" : "DOUBLE" , "dimension" : "Pressure"} ,
|
||||
{"name" : "OWC" , "value_type" : "DOUBLE" , "default" : 0.0 , "dimension" : "Length",
|
||||
"description" : "The OWC item is depth of the OIL Water contact. This should ..."} ,
|
||||
{"name" : "PC_OWC" , "value_type" : "DOUBLE" , "default" : 0.0 , "dimension" : "Pressure"} ,
|
||||
{"name" : "GOC" , "value_type" : "DOUBLE" , "default" : 0.0 , "dimension" : "Length"} ,
|
||||
{"name" : "PC_GOC" , "value_type" : "DOUBLE" , "default" : 0.0 , "dimension" : "Pressure"} ,
|
||||
{"name" : "BLACK_OIL_INIT" , "value_type" : "INT" , "default" : 0} ,
|
||||
{"name" : "BLACK_OIL_INIT_WG" , "value_type" : "INT" , "default" : 0} ,
|
||||
{"name" : "OIP_INIT" , "value_type" : "INT" , "default" : -5 , "comment":"The default is a state variable"}]}
|
||||
1
testdata/parser/keyword-generator/loader/ZCORN
vendored
Normal file
1
testdata/parser/keyword-generator/loader/ZCORN
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"name" : "ZCORN", "sections" : ["GRID"], "data" : {"value_type" : "DOUBLE", "dimension" : "Length" }}
|
||||
Reference in New Issue
Block a user