Archive run and literature indexes with historical source provenance
This commit is contained in:
1 parent
036290bb23
commit
fc2d523129
159 files changed
+580873
-3
No files matched your search
@@ -0,0 +1,40 @@
|
||||
"""Probe the candidate tensor on structured 3D plate/rod/cube meshes, no labels."""
|
||||
import itertools
|
||||
import json
|
||||
from pathlib import Path
|
||||
import sys
|
||||
import time
|
||||
import numpy as np
|
||||
from route_feasibility import graph_from_edges,node_tensor,spectral_features
|
||||
|
||||
|
||||
def box_mesh(lengths,n):
|
||||
axes=[np.linspace(0,l,n+1) for l in lengths]
|
||||
points=np.stack(np.meshgrid(*axes,indexing='ij'),axis=-1).reshape(-1,3)
|
||||
tet=[]
|
||||
for cell in itertools.product(range(n),repeat=3):
|
||||
base=np.array(cell)
|
||||
for perm in itertools.permutations(range(3)):
|
||||
ids=[base.copy()];v=base.copy()
|
||||
for axis in perm:v=v.copy();v[axis]+=1;ids.append(v)
|
||||
tet.append(np.ravel_multi_index(np.array(ids).T,(n+1,)*3))
|
||||
tet=np.array(tet);q=points[tet];vol=np.abs(np.linalg.det(q[:,1:]-q[:,:1]))/6
|
||||
mass=np.bincount(tet.ravel(),weights=np.repeat(vol/4,4),minlength=len(points))
|
||||
edges=np.unique(np.sort(tet[:,np.array(list(itertools.combinations(range(4),2)))].reshape(-1,2),axis=1),axis=0)
|
||||
return points,tet,mass,edges
|
||||
|
||||
|
||||
def main():
|
||||
out=Path(sys.argv[1]);rows=[];start=time.monotonic()
|
||||
if out.exists():raise FileExistsError(out)
|
||||
for name,lengths in [('plate',[10.,6.,.2]),('rod',[.2,.2,8.]),('cube',[1.,1.,1.])]:
|
||||
for n in [4,8,12]:
|
||||
x,tet,mass,edges=box_mesh(np.array(lengths),n);distance=np.minimum(x,np.array(lengths)-x).min(1)
|
||||
graph=graph_from_edges(len(x),edges,np.linalg.norm(x[edges[:,0]]-x[edges[:,1]],axis=1))
|
||||
tensor,_,meta=node_tensor(x,tet,mass,distance,graph);f=spectral_features(tensor)
|
||||
center=int(np.argmin(np.linalg.norm(x-np.array(lengths)/2,axis=1)))
|
||||
rows.append(dict(shape=name,n=n,nodes=len(x),full_frame_volume=float(mass[f['full']].sum()/mass.sum()),axis_volume=float(mass[f['axis']].sum()/mass.sum()),proxy_type_volume=(np.bincount(f['kind'],weights=mass,minlength=4)/mass.sum()).tolist(),center_tensor_eigenvalues=f['eigenvalues'][center].tolist(),center_full_valid=bool(f['full'][center]),center_axis_valid=bool(f['axis'][center]),**meta))
|
||||
result=dict(wall_seconds=time.monotonic()-start,rows=rows,interpretation='Exact analytic d at vertices, but candidate gradients/tensor use tetra interpolation and a fixed hop stencil. Grid refinement changes physical support. This is a sensitivity diagnostic, not a passing remesh acceptance test.')
|
||||
out.write_text(json.dumps(result,indent=2)+'\n');print(json.dumps(result,indent=2))
|
||||
|
||||
if __name__=='__main__':main()
|
||||
Reference in new issue
Block a user