Release FemLite 0.6.1
FemLite CI / build-test (push) Has been cancelled

This commit is contained in:
shenw
2026-07-01 22:41:16 +08:00
parent 175531e24d
commit 5e081806fb
32 changed files with 2819 additions and 238 deletions
@@ -7,6 +7,22 @@ import sys
CONTACT_AREA = 1.0e-2
MIN_MASTER_FACETS = 4
STATE_COLUMNS = [
"open_count",
"closed_stick_count",
"closed_slip_count",
"closed_restick_count",
"separating_count",
"state_failed_projection_count",
]
def require_columns(row: dict[str, str], columns: list[str]) -> bool:
missing = [column for column in columns if column not in row]
if missing:
print("missing contact diagnostic columns: " + ", ".join(missing))
return False
return True
def main() -> int:
@@ -19,6 +35,23 @@ def main() -> int:
if not pair_rows:
print("no contact pair rows found")
return 1
if len(pair_rows) < 2:
print("contact diagnostic path is too short")
return 1
if not require_columns(
pair_rows[0],
STATE_COLUMNS
+ [
"gap_residual",
"gap_mean",
"gap_l2",
"failed_projection_count",
"active_set_flip_count",
"aug_factor",
"aug_lambda",
],
):
return 1
profile_rows: list[dict[str, float]] = []
for index, row in enumerate(pair_rows):
@@ -33,6 +66,12 @@ def main() -> int:
release_count = int(float(row["release_count"]))
aug_factor = float(row["aug_factor"])
aug_lambda = float(row["aug_lambda"])
open_count = int(float(row["open_count"]))
closed_stick_count = int(float(row["closed_stick_count"]))
closed_slip_count = int(float(row["closed_slip_count"]))
closed_restick_count = int(float(row["closed_restick_count"]))
separating_count = int(float(row["separating_count"]))
state_failed_projection = int(float(row["state_failed_projection_count"]))
profile_rows.append(
{
"sample": float(index),
@@ -46,6 +85,12 @@ def main() -> int:
"gap_l2": gap_l2,
"failed_projection_count": float(failed_projection),
"active_set_flip_count": float(active_set_flip),
"open_count": float(open_count),
"closed_stick_count": float(closed_stick_count),
"closed_slip_count": float(closed_slip_count),
"closed_restick_count": float(closed_restick_count),
"separating_count": float(separating_count),
"state_failed_projection_count": float(state_failed_projection),
"weighted_gap": gap * CONTACT_AREA,
"multiplier_residual": abs(gap),
"aug_factor": aug_factor,
@@ -70,6 +115,12 @@ def main() -> int:
"gap_l2",
"failed_projection_count",
"active_set_flip_count",
"open_count",
"closed_stick_count",
"closed_slip_count",
"closed_restick_count",
"separating_count",
"state_failed_projection_count",
"weighted_gap",
"multiplier_residual",
"aug_factor",
@@ -85,6 +136,15 @@ def main() -> int:
max_gap = max(row["max_gap"] for row in profile_rows)
max_gap_l2 = max(row["gap_l2"] for row in profile_rows)
max_failed_projection = max(int(row["failed_projection_count"]) for row in profile_rows)
max_state_failed_projection = max(
int(row["state_failed_projection_count"]) for row in profile_rows
)
max_closed_state = max(
int(row["closed_stick_count"])
+ int(row["closed_slip_count"])
+ int(row["closed_restick_count"])
for row in profile_rows
)
max_activation_count = max(int(row["activation_count"]) for row in profile_rows)
max_release_count = max(int(row["release_count"]) for row in profile_rows)
max_weighted_gap = max(row["weighted_gap"] for row in profile_rows)
@@ -106,6 +166,24 @@ def main() -> int:
if max_failed_projection != 0:
print(f"unexpected failed projection count: {max_failed_projection}")
return 1
if max_state_failed_projection != 0:
print(f"unexpected failed projection state: {max_state_failed_projection}")
return 1
if max_closed_state <= 0:
print("closed contact state counters were not reported")
return 1
if any(
int(row["open_count"])
+ int(row["closed_stick_count"])
+ int(row["closed_slip_count"])
+ int(row["closed_restick_count"])
+ int(row["separating_count"])
+ int(row["state_failed_projection_count"])
!= 1
for row in profile_rows
):
print("contact state counters do not describe exactly one pair state")
return 1
if any(
int(row["active_set_flip_count"])
< int(row["activation_count"]) + int(row["release_count"])