Overview Schemas Index

MESH_TOPOLOGY_SCHEMA (jsdai.SMesh_topology_schema)


FUNCTION cell_counts
          (arg : vertex_defined_cell) : ARRAY [1:3] OF INTEGER;

LOCAL
  om1    : INTEGER  := 0;      -- (order - 1)
  om1sq  : INTEGER  := om1**2; -- (order - 1) squared
  vts    : INTEGER;           -- NUMBER  OF  bounding vertices
  eds    : INTEGER;           -- NUMBER  OF  edges
  qf     : INTEGER  := 0;      -- NUMBER  OF  quadrilateral faces
  tf     : INTEGER  := 0;      -- NUMBER OF  triangular faces
  result : ARRAY [1:3] OF INTEGER := [0,0,0];
END_LOCAL;
  CASE  arg.order OF
    linear    : om1 := 0;
    quadratic : om1 := 1;
    cubic     : om1 := 2;
    OTHERWISE : RETURN(result);
  END_CASE;
  om1sq := om1**2;
  CASE  arg.shape OF
    single : 
        BEGIN
          vts := 1; eds := 0; qf := 0; tf := 0;
          result[1] := vts;
          result[2] := om1*eds;                   -- 0, 0, 0
          result[3] := 0;                         -- 0, 0, 0
        END;
    line :
        BEGIN
          vts := 2; eds := 1; qf := 0; tf := 0;
          result[1] := vts;
          result[2] := om1*eds;                   -- 0, 1, 2
          result[3] := 0;                         -- 0, 0, 0
        END;
    quadrilateral : 
        BEGIN
          vts := 4; eds := 4; qf := 1; tf := 0;
          result[1] := vts;
          result[2] := om1*eds;                   -- 0, 4, 8
          result[3] := om1sq*qf;                  -- 0, 1, 4
        END;
    triangle : 
        BEGIN
          vts := 3; eds := 3; qf := 0; tf := 1;
          result[1] := vts;
          result[2] := om1*eds;                   -- 0, 3, 6
          result[3] := (om1-1)*tf;                --    0, 1
          CASE  arg.order OF
            linear : result[3] := 0;              -- 0
          END_CASE;
        END;
    polygon :
        BEGIN
          vts := arg.vn_count; eds := arg.vn_count; 
          result[1] := vts;
          result[2] := 0;
          result[3] := 0;
        END;
    hexahedron :
        BEGIN
          vts := 8; eds := 12; qf := 6; tf := 0;
          result[1] := vts;
          result[2] := om1*eds;                   -- 0, 12, 24
          result[3] := om1sq*(qf+om1);            -- 0, 7, 32
        END;
    wedge :
        BEGIN
          vts := 6; eds := 9; qf := 3; tf := 2;
          result[1] := vts;
          result[2] := om1*eds;                   -- 0, 9,  18
          result[3] := om1sq*qf + om1*tf;         -- 0, 3, 16
        END;
    tetrahedron : 
        BEGIN
          vts := 4; eds := 6; qf := 0; tf := 4;
          result[1] := vts;
          result[2] := om1*eds;                   -- 0, 6, 12
          result[3] := (om1-1)*tf;                --    0, 4
          CASE  arg.order OF
            linear : result[3] := 0;              -- 0
          END_CASE;
        END;
    pyramid : 
        BEGIN
          vts := 5; eds := 8; qf := 1; tf := 4;
          result[1] := vts;
          result[2] := om1*eds;                   -- 0, 8, 16
          result[3] := om1sq*qf + (om1-1)*tf;     --    1, 9
          CASE arg.order OF
            linear : result[3] := 0;              -- 0
          END_CASE;
        END;
  END_CASE;
RETURN(result);

END_FUNCTION; -- cell_counts

public class FCell_counts
          public static Value run(SdaiContext _context, Value arg)