Datasets:
Tasks:
Other
Formats:
json
Size:
10K - 100K
Tags:
agentfem
soft-robotics
programmable-matter
structural-mechanics
inverse-design
scientific-machine-learning
License:
Download tests/check_paraview.py from HaomingLuo/AgentFEM-Programmable-Soft-Rods: direct link, hf CLI and curl.
- Browser
- Download file 1.45 kB
-
https://huggingface.co/datasets/HaomingLuo/AgentFEM-Programmable-Soft-Rods/resolve/main/tests/check_paraview.py
- Command line
-
hf download hf://datasets/HaomingLuo/AgentFEM-Programmable-Soft-Rods/tests/check_paraview.py
-
curl -L -o check_paraview.py https://huggingface.co/datasets/HaomingLuo/AgentFEM-Programmable-Soft-Rods/resolve/main/tests/check_paraview.py
1.45 kB
| """Verify native exported fields and warp the actual negative branch.""" | |
| import json,sys | |
| from pathlib import Path | |
| from paraview.simple import OpenDataFile,UpdatePipeline,WarpByVector,Delete | |
| root=Path(sys.argv[1]);checks=[] | |
| for relative in ['paraview/native_agentfem_fig9.pvd','xdmf/native_agentfem_fig9.xdmf']: | |
| source=OpenDataFile(str(root/relative));UpdatePipeline(proxy=source) | |
| times=list(source.TimestepValues) | |
| assert len(times)==3 | |
| frames=[] | |
| for t in times: | |
| source.UpdatePipeline(t) | |
| assert 'U' in source.PointData.keys() | |
| # XDMF readers may expose scalar DG0 grids as blocks; the single-geometry | |
| # guarantee is specifically tested for the PVD delivery. | |
| assert 'MISES' in source.CellData.keys() | |
| assert 'MICROFORCE_POTENTIAL' in source.CellData.keys() | |
| assert source.GetDataInformation().GetNumberOfCells()==400 | |
| warp=WarpByVector(Input=source);warp.Vectors=['POINTS','U'];warp.ScaleFactor=1 | |
| warp.UpdatePipeline(t);bounds=list(warp.GetDataInformation().GetBounds()) | |
| assert bounds[2]<-.05 | |
| frames.append(dict(case_index=t,points=warp.GetDataInformation().GetNumberOfPoints(),cells=warp.GetDataInformation().GetNumberOfCells(),warped_bounds=bounds)) | |
| Delete(warp) | |
| checks.append(dict(file=relative,frames=frames));Delete(source) | |
| (root/'paraview_checks.json').write_text(json.dumps(checks,indent=2));print(json.dumps(checks,indent=2)) | |