I reffered the following example,
PeriodicSpace example
The ”Rectangle Example” seems to be working, however, no pair appears with the ”Sphere Example".
I have tested with Identifiy pairs of the faces, but none of them worked out.
Rectangle Example
from ngsolve import *
from netgen.occ import *
from ngsolve.webgui import Draw
shape = Rectangle(1,1).Face()
shape.edges.Max(X).name = "right"
shape.edges.Min(X).name = "left"
shape.edges.Max(Y).name = "top"
shape.edges.Min(Y).name = "bot"
shape.edges.Max(Y).Identify(shape.edges.Min(Y), "bt")
shape.edges.Max(X).Identify(shape.edges.Min(X), "lr")
mesh = Mesh(OCCGeometry(shape, dim=2).GenerateMesh(maxh=0.1))
Draw(mesh, settings={"Objects": {"Edges": False, "Surface": True}});
for pair in mesh.ngmesh.GetIdentifications():
print([mesh.vertices[pair[0]-1].point, mesh.vertices[pair[1]-1].point])
Sphere Example
from ngsolve import *
from netgen.occ import *
from ngsolve.webgui import Draw
sph1 = Sphere(Pnt(0,0,0.0), r=1)
sph2 = Sphere(Pnt(0,0,2.5), r=1)
sph = sph1+sph2
sph.edges[0].name = "e0"
sph.edges[1].name = "e1"
sph.edges[2].name = "e2"
sph.edges[3].name = "e3"
sph.faces[0].Identify(sph.faces[1],"ud0")
#sph.edges[0].Identify(sph.edges[1],"ud0")
#sph.edges[2].Identify(sph.edges[3],"ud1")
#sph.edges[4].Identify(sph.edges[5],"ud2")
#sph.edges[6].Identify(sph.edges[7],"ud3")
mesh = Mesh(OCCGeometry(sph).GenerateMesh(maxh=0.5)).Curve(2)
Draw(mesh, settings={"camera": {"transformations": [{"type": "rotateX", "angle": -90},{"type": "rotateZ", "angle": 90}]}, "Objects": {"Edges": False, "Surface": True}}, clipping={ "x" : 0.1, "y" : 0, "z" : 0, "dist":0, "function":True});
for pair in mesh.ngmesh.GetIdentifications():
print([mesh.vertices[pair[0]-1].point, mesh.vertices[pair[1]-1].point])```