number of cell vertices Function


A number_of_cell_vertices function calculates the number of vertices for a Vertex_defined_cell.

EXPRESS specification:

*)
FUNCTION number_of_cell_vertices 
      (dimension : INTEGER;
       shape_code :  STRING;
       order :  ARRAY[1,dimension] OF INTEGER) :
    INTEGER;
  LOCAL 
    number_of_cell_vertices : INTEGER;
    k : INTEGER;
  END_LOCAL;
  CASE dimension OF 
    1 : number_of_cell_vertices := order[1] + 1;      (* edge *) 
    2 : CASE shape_code OF 

      'TS001' : number_of_cell_vertices :=            (* triangle *)
              ((order[1] + 1) * (order[1] + 2)) / 2;
      'TS002' : number_of_cell_vertices :=            (* quadrilateral*) 
              (order[1] + 1) * (order[2]+ 1);
        END_CASE;
    3 : CASE shape_code OF       
      'TS003' : number_of_cell_vertices :=            (* tetrahedron *) 
              (order[1] + 1) * (order[1] + 2) * (order[1] + 3) / 6;
      'TS004' :                                       (* pyramid *) 
              BEGIN
                number_of_cell_vertices := 0;
                REPEAT k := 0 TO order[1] BY 1;
                  number_of_cell_vertices := number_of_cell_vertices +
                                           (k + 1) * (k + 1);
                END_REPEAT;

              END; 
      'TS005' : number_of_cell_vertices :=            (* wedge *) 
            ((order[1] + 1) * (order[1] + 2) / 2) * (order[3] + 1);
      'TS006' : number_of_cell_vertices :=            (* hexahedron *) 
            (order[1] + 1) * (order[2] + 1) * (order[3] + 1);
        END_CASE;
    OTHERWISE :                                       (* hyperbrick *)
      BEGIN
        number_of_cell_vertices := 1;
        REPEAT k := 1 TO dimension BY 1;
          number_of_cell_vertices := number_of_cell_vertices * 
                                          (order[k] + 1);    
        END_REPEAT;
      END;
  ENDCASE;  
  RETURN (number_of_cell_vertices);
END_FUNCTION;
(*

Argument definitions:

dimension: the topological dimension of the Mesh_cell.

shape_code: the shape code for the Mesh_cell as defined in Topological_shape. The shape code is only required for dimension 2 or 3.

order: the order of a Mesh_cell in each topological direction. The order is defined so that the number of vertices along an edge running in topological direction [i] (including the vertices at the ends of the edge) is order[i] + 1.