SCHEMA Unstructured_mesh_arm;
  
USE FROM Mesh_arm -- Mesh
  (Region,
  Mesh,
  Vertex);
  
ENTITY Mesh_cell
  SUBTYPE OF (Mesh);
  cells :  LIST[1,?] OF Region;
  vertices :  OPTIONAL LIST[1,?] OF Vertex;
END_ENTITY;
  
ENTITY Vertex_defined_cell
  SUBTYPE OF (Region);
  order :  ARRAY[1,dimension] OF INTEGER;
  vertices :  ARRAY[1,number_of_vertices] OF OPTIONAL Vertex;
  DERIVE
    dimension :  INTEGER := SELF/Region.topological_dimension;
    standard_shape :  BOOLEAN := SELF/Region.standard_shape;
    shape_code :  STRING := SELF/Region.shape_code;
    number_of_vertices :  INTEGER :=
           number_of_cell_vertices (dimension, shape_code, order);
  WHERE
    necessary_shape :
      IF (dimesion = 2) OR (dimension = 3) THEN
        standard_shape;
      ELSE
        TRUE;
      END_IF; 
    valid_order : 
      CASE dimension OF
        2 : CASE shape_code OF
             'TS001' : order[1] = order[2];         
  
             OTHERWISE : TRUE;
           END_CASE;
        3 : CASE shape_code OF
             'TS003' : order[1] = order[2] AND
                       order[1] = order[3];         
  
             'TS004' : order[1] = order[2] AND
                       order[1] = order[3];         
  
             'TS005' : order[1] = order[2];         
  
             OTHERWISE : TRUE;
           END_CASE;
        OTHERWISE : TRUE;
      END_CASE;   
END_ENTITY;
  
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;      
   
    2 : CASE shape_code OF 
      'TS001' : number_of_cell_vertices :=            
  
              ((order[1] + 1) * (order[1] + 2)) / 2;
      'TS002' : number_of_cell_vertices :=            
   
              (order[1] + 1) * (order[2]+ 1);
        END_CASE;
    3 : CASE shape_code OF       
      'TS003' : number_of_cell_vertices :=            
   
              (order[1] + 1) * (order[1] + 2) * (order[1] + 3) / 6;
      'TS004' :                                       
   
              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 :=            
   
            ((order[1] + 1) * (order[1] + 2) / 2) * (order[3] + 1);
      'TS006' : number_of_cell_vertices :=            
   
            (order[1] + 1) * (order[2] + 1) * (order[3] + 1);
        END_CASE;
    OTHERWISE :                                       
  
      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;
  
END_SCHEMA;

Page last updated - 7 Sep 2000