I'm working on a computer code to mesh a N-dimensional space with N-dimensional hypercubes and do some physics in it. I am wondering if I can produce a generic code (with C++ templates, but that is not the subject here) that is ok for N = 2, 3, 4...
My question is about the extraction of the N-M dimensionnal faces of the cubes. These faces are N-M dimensionnal hypercubes in a N dimensionnal space (for exemple the faces of a 3-dimensional hypercubes (a cube) are 2-dimensional hypercubes (squares) in a 3-dimensional space).
Is there a generic way to define the data I need to characterize these N-M faces (different from storing all their vertexes).
To illustrate that here is a example in N=3 dimensions :
- For the N=3 cube I need at least : a center (3 coordinates) + the side length (1 number)
- For its N-1=2 dimensional faces (faces) I need at least: a center (3 coordinates) + the side length (1 number) + the plane normal vector (3 coordinates)
- For its N-2=1 dimensional faces (edges) I need at least : the coordinates of the two points (6 coordinates)
- For its N-3 = 0 dimensional faces (vertexes) I need a least : 3 coordinates
This way to define the faces is very heterogeneous and not generic at all. What is the most optimal (from a memory point of view) generic way to define a N-M hypercube face in a N dimensional space ?
Thank you very much.