Skip to content

Commit 3e2ad1d

Browse files
committed
Merge branch 'development' into preview
2 parents dbbad05 + 79644ad commit 3e2ad1d

7 files changed

Lines changed: 173 additions & 5 deletions

features/environment.py

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,40 @@ def set_logger(context):
5252

5353
return logger
5454

55+
56+
57+
def _read_proc_kb(field, path='/proc/self/status'):
58+
"""Read a '<field>: <n> kB' line from /proc. Returns None when unavailable."""
59+
try:
60+
with open(path) as f:
61+
for line in f:
62+
if line.startswith(field + ':'):
63+
return int(line.split()[1])
64+
except (OSError, ValueError, IndexError):
65+
pass
66+
return None
67+
68+
69+
def _reset_peak_rss():
70+
"""Reset the kernel peak-memory counter (VmHWM) to the current RSS. Linux-only."""
71+
try:
72+
with open('/proc/self/clear_refs', 'w') as f:
73+
f.write('5')
74+
return True
75+
except OSError:
76+
return False
77+
78+
79+
def _feature_mem_txt(context):
80+
"""Peak memory for this feature: the high-water mark since before_feature,
81+
and how much that is above the memory at feature start. Empty if /proc is unusable."""
82+
peak_kb = _read_proc_kb('VmHWM')
83+
start_kb = getattr(context, 'feature_rss_start_kb', None)
84+
if peak_kb and start_kb and getattr(context, 'feature_peak_reset', False):
85+
delta_mb = (peak_kb - start_kb) / 1024
86+
return f" Peak RSS: {peak_kb/1024:.0f} MB (delta {delta_mb:+.0f} MB)."
87+
return ""
88+
5589
def before_feature(context, feature):
5690
#@todo incorporate into gherkin error handling
5791
# assert protocol.enforce(context, feature), 'failed'
@@ -62,7 +96,12 @@ def before_feature(context, feature):
6296
except KeyError: # run via console, task_id not provided
6397
context.validation_task_id = None
6498
Scenario.continue_after_failed_step = False
65-
99+
100+
# note current RSS and reset the kernel peak counter so that VmHWM in
101+
# after_feature reflects the peak of *this* feature only.
102+
context.feature_rss_start_kb = _read_proc_kb('VmRSS')
103+
context.feature_peak_reset = _reset_peak_rss()
104+
66105
execution_mode = context.config.userdata.get('execution_mode')
67106
if execution_mode and execution_mode == 'ExecutionMode.PRODUCTION':
68107
context.feature_start_time = time.process_time()
@@ -177,7 +216,7 @@ def reduce_db_outcomes(feature_outcomes):
177216
end_time = time.process_time()
178217
elapsed_time = end_time - context.feature_start_time
179218
logger = set_logger(context)
180-
logger.info(f"Feature '{feature.name}' completed. Elapsed process time: {elapsed_time:.2f} seconds.")
219+
logger.info(f"Feature '{feature.name}' completed. Elapsed process time: {elapsed_time:.2f} seconds.{_feature_mem_txt(context)}")
181220

182221
else: # invoked via console or CI/CD pipeline
183222
outcomes = [outcome.to_dict() for outcome in context.gherkin_outcomes]

features/rules/IFC/IFC430_Entities-in-scope-for-IFC-4X3-ReferenceView-MVD.feature

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@IFC
2-
@version1
2+
@version2
33
@industry-practice
44
Feature: IFC430 - Entities in scope for IFC 4X3 ReferenceView MVD
55

@@ -131,6 +131,7 @@ do not export any entities that are outside the scope of this MVD.
131131
| IfcLinearPlacement |
132132
| IfcLoop |
133133
| IfcLShapeProfileDef |
134+
| IfcMapConversionScaled
134135
| IfcMaterialClassificationRelationship |
135136
| IfcMaterialDefinitionRepresentation |
136137
| IfcMaterialLayerSetUsage |

features/rules/IFC/IFC431_Entities-in-scope-for-IFC-4X3-Alignment-basedView-MVD.feature

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@IFC
2-
@version1
2+
@version2
33
@industry-practice
44
Feature: IFC431 - Entities in scope for IFC 4X3 Alignment-basedView MVD
55

@@ -126,6 +126,7 @@ do not export any entities that are outside the scope of this MVD.
126126
| IfcMaterialProfileWithOffsets |
127127
| IfcMaterialRelationship |
128128
| IfcMaterialUsageDefinition |
129+
| IfcMapConversionScaled
129130
| IfcMetric |
130131
| IfcMirroredProfileDef |
131132
| IfcObjective |
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
@implementer-agreement
2+
@TAS
3+
@version1
4+
Feature: TAS000 - Tessellated Geometry
5+
The rule verifies the presence of IFC entities used to define tessellated geometry (i.e. meshes) used as shape representations.
6+
7+
8+
Background:
9+
10+
Given A model with Schema 'IFC4' or 'IFC4.3'
11+
12+
13+
Scenario: Shape representation via Tessellated Item
14+
15+
Given An .IfcTessellatedItem.
16+
17+
Then The IFC model contains information on the selected functional part
18+
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
ISO-10303-21;
2+
HEADER;
3+
FILE_DESCRIPTION(('ViewDefinition [ReferenceView]'),'2;1');
4+
FILE_NAME('na-tas000-no_tessellated_items.ifc','2024-06-12T09:50:55',(''),(''),'redacted','redacted - redacted - 3.14159','');
5+
FILE_SCHEMA(('IFC4X3_ADD2'));
6+
ENDSEC;
7+
DATA;
8+
9+
/* PROJECT CONTEXT */
10+
#1= IFCPROJECT('2eS$fZmw9QmetNIywDEzSR',#2,'redacted',$,$,$,$,(#10),#120);
11+
#2= IFCOWNERHISTORY(#3,#6,$,.NOCHANGE.,$,$,$,152828);
12+
#3= IFCPERSONANDORGANIZATION(#4,#5,$);
13+
#4= IFCPERSON($,'','redacted',$,$,$,$,$);
14+
#5= IFCORGANIZATION($,'redacted',$,$,$);
15+
#6= IFCAPPLICATION(#5,'redacted','redacted','redacted');
16+
17+
#10= IFCGEOMETRICREPRESENTATIONCONTEXT($,'Model',3,1.0E-05,#11,$);
18+
#11= IFCAXIS2PLACEMENT3D(#12,$,$);
19+
#12= IFCCARTESIANPOINT((0.,0.,0.));
20+
21+
22+
#20=IFCGEOMETRICREPRESENTATIONSUBCONTEXT('Axis','Model',*,*,*,*,#10,$,.MODEL_VIEW.,$);
23+
24+
/* SITES AGGREGATED TO PROJECT */
25+
#29=IFCRELAGGREGATES('2te7nJfPvJyvPEahDDrZW0',#2,'ProjectContainer',$,#1,(#29990));
26+
#31=IFCLOCALPLACEMENT($,#11);
27+
28+
#101= IFCSIUNIT(*,.LENGTHUNIT.,.MILLI.,.METRE.);
29+
#102= IFCSIUNIT(*,.AREAUNIT.,$,.SQUARE_METRE.);
30+
#103= IFCSIUNIT(*,.VOLUMEUNIT.,$,.CUBIC_METRE.);
31+
#104= IFCSIUNIT(*,.MASSUNIT.,.KILO.,.GRAM.);
32+
#105= IFCSIUNIT(*,.TIMEUNIT.,$,.SECOND.);
33+
#106= IFCSIUNIT(*,.PLANEANGLEUNIT.,$,.RADIAN.);
34+
#107= IFCSIUNIT(*,.SOLIDANGLEUNIT.,$,.STERADIAN.);
35+
#108= IFCSIUNIT(*,.POWERUNIT.,$,.WATT.);
36+
#109= IFCSIUNIT(*,.THERMODYNAMICTEMPERATUREUNIT.,$,.KELVIN.);
37+
38+
#120= IFCUNITASSIGNMENT((#101,#102,#103,#104,#105,#106,#107,#108,#109));
39+
40+
41+
#2658= IFCBUILDING('1q4MsgfUf4Metm2lRt$BR5',#2,'','',$,#31,$,$,.ELEMENT.,$,$,$);
42+
#2659= IFCRELAGGREGATES('2te7nJfPvHzxPEahDDrZW0',#2,'BuildingToSite',$,#29990,(#2658));
43+
44+
#2660= IFCBUILDINGSTOREY('0xuqbikJfFxhmSCs$dJm45',#2,'','',$,#31,$,$,.ELEMENT.,0.);
45+
#2661= IFCRELAGGREGATES('2te8MJfPvJyvPEahDDrZW0',#2,'StoreyToBuilding',$,#2658,(#2660));
46+
47+
48+
#2698= IFCSLAB('3t_W_rZgvCfQ$zs2L2Bu$9',#2,'None',$,$,$,$,$,$);
49+
#2699= IFCPROPERTYBOUNDEDVALUE('TemperatureSetPoint',$,IFCTHERMODYNAMICTEMPERATUREMEASURE(100.),IFCTHERMODYNAMICTEMPERATUREMEASURE(0.),$,IFCTHERMODYNAMICTEMPERATUREMEASURE(50.));
50+
#2700= IFCPROPERTYSET('3DbfSRjZfDAPy34OG_JZ9j',$,'Properties',$,(#2699));
51+
#2701= IFCRELDEFINESBYPROPERTIES('2Bjmd6iZnFueQWNGcZluMM',#2,'Object to Properties','Object to Properties Relation',(#2698),#2700);
52+
53+
#2812= IFCRELCONTAINEDINSPATIALSTRUCTURE('1ejyelJ$TEWPzK6IRogGcX', #2, '', 'Slab to Storey', (#2698), #2660);
54+
55+
56+
#29990=IFCSITE('14oxcl5LHMZQ6iCWJKpe5w',#2,'SITE_withCorrectGuid',$,$,#31,$,$,.COMPLEX.,$,$,$,$,$);
57+
ENDSEC;
58+
END-ISO-10303-21;
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
ISO-10303-21;
2+
HEADER;
3+
FILE_DESCRIPTION(('ViewDefinition [ReferenceView_V1.2]'),'2;1');
4+
FILE_NAME('pass-tas00--PolygonalFaceSet_rect.ifc','2024-10-08T20:16:01',(''),(''),'','redacted - redacted - 3.14159','');
5+
FILE_SCHEMA(('IFC4'));
6+
ENDSEC;
7+
DATA;
8+
#1=IFCPERSON($,$,'',$,$,$,$,$);
9+
#2=IFCORGANIZATION($,'',$,$,$);
10+
#3=IFCPERSONANDORGANIZATION(#1,#2,$);
11+
#4=IFCAPPLICATION(#2,'0.7.11-d51fa2c5f','redacted','');
12+
#5=IFCOWNERHISTORY(#3,#4,$,.NOTDEFINED.,$,#3,#4,1728418561);
13+
#6=IFCDIRECTION((1.,0.,0.));
14+
#7=IFCDIRECTION((0.,0.,1.));
15+
#8=IFCCARTESIANPOINT((0.,0.,0.));
16+
#9=IFCAXIS2PLACEMENT3D(#8,#7,#6);
17+
#10=IFCDIRECTION((0.,1.));
18+
#11=IFCGEOMETRICREPRESENTATIONCONTEXT($,'Model',3,1.E-05,#9,#10);
19+
#12=IFCDIMENSIONALEXPONENTS(0,0,0,0,0,0,0);
20+
#13=IFCSIUNIT(*,.LENGTHUNIT.,$,.METRE.);
21+
#14=IFCSIUNIT(*,.AREAUNIT.,$,.SQUARE_METRE.);
22+
#15=IFCSIUNIT(*,.VOLUMEUNIT.,$,.CUBIC_METRE.);
23+
#16=IFCSIUNIT(*,.PLANEANGLEUNIT.,$,.RADIAN.);
24+
#17=IFCMEASUREWITHUNIT(IFCPLANEANGLEMEASURE(0.017453292519943295),#16);
25+
#19=IFCUNITASSIGNMENT((#13,#14,#15,#16));
26+
#20=IFCPROJECT('0c1kJn_Qb6lxCutc7bMdzD',#5,'',$,$,$,$,(#11),#19);
27+
#21=IFCSITE('0U$cKviQP13wtOZUMKDIyS',$,'MySite','{ProxySite}',$,$,$,$,.ELEMENT.,$,$,$,'1234',$);
28+
#22=IFCGEOMETRICREPRESENTATIONSUBCONTEXT('Body','Model',*,*,*,*,#11,0.01,.MODEL_VIEW.,$);
29+
#23=IFCCARTESIANPOINT((0.,0.,0.));
30+
#24=IFCAXIS2PLACEMENT3D(#23,$,$);
31+
#25=IFCLOCALPLACEMENT($,#24);
32+
#26=IFCBUILDING('0irtZ8nxzFvRcKTOGXgg4g',$,'MyBuilding','ProxyHolder',$,#25,$,$,$,$,$,$);
33+
#27=IFCRELAGGREGATES('2xKsyZHRjC3fxCBLloBBfc',$,$,$,#21,(#26));
34+
#28=IFCRELAGGREGATES('2T4mGks3r8LgFvcmA7ZUL2',$,$,$,#20,(#21));
35+
#29=IFCINDEXEDPOLYGONALFACE((2,1,5,6));
36+
#30=IFCINDEXEDPOLYGONALFACE((3,2,6,7));
37+
#31=IFCINDEXEDPOLYGONALFACE((4,3,7,8));
38+
#32=IFCINDEXEDPOLYGONALFACE((1,4,8,5));
39+
#33=IFCINDEXEDPOLYGONALFACE((4,3,2,1));
40+
#34=IFCINDEXEDPOLYGONALFACE((5,6,7,8));
41+
#35=IFCCARTESIANPOINTLIST3D(((0.,0.,0.),(1.,0.,0.),(1.,1.,0.),(0.,1.,0.),(0.,0.,1.),(1.,0.,1.),(1.,1.,1.),(0.,1.,1.)));
42+
#36=IFCPOLYGONALFACESET(#35,.F.,(#29,#30,#31,#32,#33,#34),$);
43+
#37=IFCSHAPEREPRESENTATION(#11,'Body','Tessellation',(#36));
44+
#38=IFCPRODUCTDEFINITIONSHAPE($,$,(#37));
45+
#39=IFCCARTESIANPOINT((0.,0.,0.));
46+
#40=IFCAXIS2PLACEMENT3D(#39,$,$);
47+
#41=IFCLOCALPLACEMENT($,#40);
48+
#42=IFCBUILDINGELEMENTPROXY('0A1CD3BUf5vfG_FwB3FzLd',$,'Proxy',$,$,#41,#38,$,$);
49+
#43=IFCRELCONTAINEDINSPATIALSTRUCTURE('0hoRQKeHr6FgZfPsvI5prc',$,'Building','Building Container For Elements',(#42),#26);
50+
ENDSEC;
51+
END-ISO-10303-21;

0 commit comments

Comments
 (0)