Skip to content
Snippets Groups Projects
Commit 02ad90b5 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

-= operation on lists

parent 734dd55d
No related branches found
No related tags found
No related merge requests found
This diff is collapsed.
/* A Bison parser, made by GNU Bison 2.4.1. */
/* A Bison parser, made by GNU Bison 2.4.3. */
/* Skeleton interface for Bison's Yacc-like parsers in C
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
2009, 2010 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -185,7 +184,7 @@
typedef union YYSTYPE
{
/* Line 1676 of yacc.c */
/* Line 1685 of yacc.c */
#line 89 "Gmsh.y"
char *c;
......@@ -198,8 +197,8 @@ typedef union YYSTYPE
/* Line 1676 of yacc.c */
#line 203 "Gmsh.tab.hpp"
/* Line 1685 of yacc.c */
#line 202 "Gmsh.tab.hpp"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
......
......@@ -104,7 +104,8 @@ fullMatrix<double> ListOfListOfDouble2Matrix(List_T *list);
%token tAtan tAtan2 tSinh tCosh tTanh tFabs tFloor tCeil
%token tFmod tModulo tHypot
%token tPrintf tSprintf tStrCat tStrPrefix tStrRelative
%token tBoundingBox tDraw tToday tSyncModel tCreateTopology tCreateTopologyNoHoles tDistanceFunction
%token tBoundingBox tDraw tToday tSyncModel tCreateTopology tCreateTopologyNoHoles
%token tDistanceFunction
%token tPoint tCircle tEllipse tLine tSphere tPolarSphere tSurface tSpline tVolume
%token tCharacteristic tLength tParametric tElliptic tRefineMesh
%token tPlane tRuled tTransfinite tComplex tPhysical tCompound tPeriodic
......@@ -120,7 +121,6 @@ fullMatrix<double> ListOfListOfDouble2Matrix(List_T *list);
%token tGMSH_MAJOR_VERSION tGMSH_MINOR_VERSION tGMSH_PATCH_VERSION
%token tHomRank tHomGen tHomCut tHomSeq
%type <d> FExpr FExpr_Single
%type <v> VExpr VExpr_Single CircleOptions TransfiniteType
%type <i> NumericAffectation NumericIncrement PhysicalId
......@@ -699,6 +699,16 @@ Affectation :
Free($1);
List_Delete($5);
}
| tSTRING '[' ']' tAFFECTMINUS ListOfDouble tEND
{
// remove from the list
for(int i = 0; i < List_Nbr($5); i++)
gmsh_yysymbols[$1].erase(std::find(gmsh_yysymbols[$1].begin(),
gmsh_yysymbols[$1].end(),
*(double*)List_Pointer($5, i)));
Free($1);
List_Delete($5);
}
| tSTRING NumericIncrement tEND
{
if(!gmsh_yysymbols.count($1))
......
......@@ -73,6 +73,7 @@ typedef int flex_int32_t;
typedef unsigned char flex_uint8_t;
typedef unsigned short int flex_uint16_t;
typedef unsigned int flex_uint32_t;
#endif /* ! C99 */
/* Limits of integral types. */
#ifndef INT8_MIN
......@@ -103,8 +104,6 @@ typedef unsigned int flex_uint32_t;
#define UINT32_MAX (4294967295U)
#endif
#endif /* ! C99 */
#endif /* ! FLEXINT_H */
#ifdef __cplusplus
......@@ -161,15 +160,7 @@ typedef unsigned int flex_uint32_t;
/* Size of default input buffer. */
#ifndef YY_BUF_SIZE
#ifdef __ia64__
/* On IA-64, the buffer size is 16k, not 8k.
* Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
* Ditto for the __ia64__ case accordingly.
*/
#define YY_BUF_SIZE 32768
#else
#define YY_BUF_SIZE 16384
#endif /* __ia64__ */
#endif
/* The state buf must be large enough to hold one state per character in the main buffer.
......@@ -181,7 +172,12 @@ typedef unsigned int flex_uint32_t;
typedef struct yy_buffer_state *YY_BUFFER_STATE;
#endif
extern int gmsh_yyleng;
#ifndef YY_TYPEDEF_YY_SIZE_T
#define YY_TYPEDEF_YY_SIZE_T
typedef size_t yy_size_t;
#endif
extern yy_size_t gmsh_yyleng;
extern FILE *gmsh_yyin, *gmsh_yyout;
......@@ -207,11 +203,6 @@ extern FILE *gmsh_yyin, *gmsh_yyout;
#define unput(c) yyunput( c, (yytext_ptr) )
#ifndef YY_TYPEDEF_YY_SIZE_T
#define YY_TYPEDEF_YY_SIZE_T
typedef size_t yy_size_t;
#endif
#ifndef YY_STRUCT_YY_BUFFER_STATE
#define YY_STRUCT_YY_BUFFER_STATE
struct yy_buffer_state
......@@ -229,7 +220,7 @@ struct yy_buffer_state
/* Number of characters read into yy_ch_buf, not including EOB
* characters.
*/
int yy_n_chars;
yy_size_t yy_n_chars;
/* Whether we "own" the buffer - i.e., we know we created it,
* and can realloc() it to grow it, and should free() it to
......@@ -299,8 +290,8 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
/* yy_hold_char holds the character lost when gmsh_yytext is formed. */
static char yy_hold_char;
static int yy_n_chars; /* number of characters read into yy_ch_buf */
int gmsh_yyleng;
static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */
yy_size_t gmsh_yyleng;
/* Points to current character in buffer. */
static char *yy_c_buf_p = (char *) 0;
......@@ -328,7 +319,7 @@ static void gmsh_yy_init_buffer (YY_BUFFER_STATE b,FILE *file );
YY_BUFFER_STATE gmsh_yy_scan_buffer (char *base,yy_size_t size );
YY_BUFFER_STATE gmsh_yy_scan_string (yyconst char *yy_str );
YY_BUFFER_STATE gmsh_yy_scan_bytes (yyconst char *bytes,int len );
YY_BUFFER_STATE gmsh_yy_scan_bytes (yyconst char *bytes,yy_size_t len );
void *gmsh_yyalloc (yy_size_t );
void *gmsh_yyrealloc (void *,yy_size_t );
......@@ -949,7 +940,7 @@ void skipline(void);
#define YY_NO_UNISTD_H
#endif
#line 953 "Gmsh.yy.cpp"
#line 944 "Gmsh.yy.cpp"
#define INITIAL 0
......@@ -988,7 +979,7 @@ FILE *gmsh_yyget_out (void );
void gmsh_yyset_out (FILE * out_str );
int gmsh_yyget_leng (void );
yy_size_t gmsh_yyget_leng (void );
char *gmsh_yyget_text (void );
......@@ -1030,12 +1021,7 @@ static int input (void );
/* Amount of stuff to slurp up with each read. */
#ifndef YY_READ_BUF_SIZE
#ifdef __ia64__
/* On IA-64, the buffer size is 16k, not 8k */
#define YY_READ_BUF_SIZE 16384
#else
#define YY_READ_BUF_SIZE 8192
#endif /* __ia64__ */
#endif
/* Copy whatever the last rule matched to the standard output. */
......@@ -1043,7 +1029,7 @@ static int input (void );
/* This used to be an fputs(), but since the string might contain NUL's,
* we now use fwrite().
*/
#define ECHO do { if (fwrite( gmsh_yytext, gmsh_yyleng, 1, gmsh_yyout )) {} } while (0)
#define ECHO fwrite( gmsh_yytext, gmsh_yyleng, 1, gmsh_yyout )
#endif
/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
......@@ -1054,7 +1040,7 @@ static int input (void );
if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
{ \
int c = '*'; \
size_t n; \
yy_size_t n; \
for ( n = 0; n < max_size && \
(c = getc( gmsh_yyin )) != EOF && c != '\n'; ++n ) \
buf[n] = (char) c; \
......@@ -1139,7 +1125,7 @@ YY_DECL
#line 49 "Gmsh.l"
#line 1143 "Gmsh.yy.cpp"
#line 1129 "Gmsh.yy.cpp"
if ( !(yy_init) )
{
......@@ -2014,7 +2000,7 @@ YY_RULE_SETUP
#line 235 "Gmsh.l"
ECHO;
YY_BREAK
#line 2018 "Gmsh.yy.cpp"
#line 2004 "Gmsh.yy.cpp"
case YY_STATE_EOF(INITIAL):
yyterminate();
......@@ -2200,7 +2186,7 @@ static int yy_get_next_buffer (void)
else
{
int num_to_read =
yy_size_t num_to_read =
YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
while ( num_to_read <= 0 )
......@@ -2214,7 +2200,7 @@ static int yy_get_next_buffer (void)
if ( b->yy_is_our_buffer )
{
int new_size = b->yy_buf_size * 2;
yy_size_t new_size = b->yy_buf_size * 2;
if ( new_size <= 0 )
b->yy_buf_size += b->yy_buf_size / 8;
......@@ -2245,7 +2231,7 @@ static int yy_get_next_buffer (void)
/* Read in more data. */
YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
(yy_n_chars), (size_t) num_to_read );
(yy_n_chars), num_to_read );
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
}
......@@ -2355,7 +2341,7 @@ static int yy_get_next_buffer (void)
if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
{ /* need to shift things up to make room */
/* +2 for EOB chars. */
register int number_to_move = (yy_n_chars) + 2;
register yy_size_t number_to_move = (yy_n_chars) + 2;
register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
register char *source =
......@@ -2404,7 +2390,7 @@ static int yy_get_next_buffer (void)
else
{ /* need more input */
int offset = (yy_c_buf_p) - (yytext_ptr);
yy_size_t offset = (yy_c_buf_p) - (yytext_ptr);
++(yy_c_buf_p);
switch ( yy_get_next_buffer( ) )
......@@ -2428,7 +2414,7 @@ static int yy_get_next_buffer (void)
case EOB_ACT_END_OF_FILE:
{
if ( gmsh_yywrap( ) )
return EOF;
return 0;
if ( ! (yy_did_buffer_switch_on_eof) )
YY_NEW_FILE;
......@@ -2680,7 +2666,7 @@ void gmsh_yypop_buffer_state (void)
*/
static void gmsh_yyensure_buffer_stack (void)
{
int num_to_alloc;
yy_size_t num_to_alloc;
if (!(yy_buffer_stack)) {
......@@ -2772,17 +2758,16 @@ YY_BUFFER_STATE gmsh_yy_scan_string (yyconst char * yystr )
/** Setup the input buffer state to scan the given bytes. The next call to gmsh_yylex() will
* scan from a @e copy of @a bytes.
* @param yybytes the byte buffer to scan
* @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
* @param bytes the byte buffer to scan
* @param len the number of bytes in the buffer pointed to by @a bytes.
*
* @return the newly allocated buffer state object.
*/
YY_BUFFER_STATE gmsh_yy_scan_bytes (yyconst char * yybytes, int _yybytes_len )
YY_BUFFER_STATE gmsh_yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len )
{
YY_BUFFER_STATE b;
char *buf;
yy_size_t n;
int i;
yy_size_t n, i;
/* Get memory for full buffer, including space for trailing EOB's. */
n = _yybytes_len + 2;
......@@ -2864,7 +2849,7 @@ FILE *gmsh_yyget_out (void)
/** Get the length of the current token.
*
*/
int gmsh_yyget_leng (void)
yy_size_t gmsh_yyget_leng (void)
{
return gmsh_yyleng;
}
......
......@@ -133,7 +133,7 @@ Physical Surface(74) = {46, 18, 20, 52, 22, 50, 24, 48, 66, 63, 60, 58, 56, 54};
// Complement of the domain surface respect to the four terminals
Physical Surface(75) = {46, 63, 66, 52, 50, 48, 54, 60, 58, 56};
/*
// Create a mesh of the model
Mesh 3;
......@@ -157,4 +157,4 @@ HomCut("t10_hom.msh") = {{69}, {70, 71, 72, 73}};
// HomGen("t10_hom.msh") = {{}, {}};
// HomGen("t10_hom.msh") = {{69}, {74}};
// HomGen("t10_hom.msh") = {{}, {74}};
*/
/*********************************************************************
*
* Gmsh tutorial 13
*
* Homology computation
*
*********************************************************************/
// Homology computation in Gmsh finds representative chains of
// (relative) homology spaces using a mesh of a model. Those
// representatives generate the (relative) homology spaces of the
// model. Alternatively, Gmsh can only look for the ranks of the
// (relative) homology spaces, the Betti numbers of the model.
// The generators chains are stored in a given .msh-file as physical
// groups, whose mesh elements are oriented such that their
// coefficients are 1 in the generator chain.
// Create an example geometry
m = 0.5; // mesh characteristic length
h = 2; // height in the z-direction
Point(1) = {0, 0, 0, m}; Point(2) = {10, 0, 0, m};
Point(3) = {10, 10, 0, m}; Point(4) = {0, 10, 0, m};
Point(5) = {4, 4, 0, m}; Point(6) = {6, 4, 0, m};
Point(7) = {6, 6, 0, m}; Point(8) = {4, 6, 0, m};
Point(9) = {2, 0, 0, m}; Point(10) = {8, 0, 0, m};
Point(11) = {2, 10, 0, m}; Point(12) = {8, 10, 0, m};
Line(1) = {1, 9}; Line(2) = {9, 10}; Line(3) = {10, 2};
Line(4) = {2, 3}; Line(5) = {3, 12}; Line(6) = {12, 11};
Line(7) = {11, 4}; Line(8) = {4, 1}; Line(9) = {5, 6};
Line(10) = {6, 7}; Line(11) = {7, 8}; Line(12) = {8, 5};
Line Loop(13) = {6, 7, 8, 1, 2, 3, 4, 5};
Line Loop(14) = {11, 12, 9, 10};
Plane Surface(15) = {13, 14};
Extrude {0, 0, h}{ Surface{15}; }
// Create physical groups, which are used to define the domain of the
// homology computation and the subdomain of the relative homology
// computation.
// Whole domain
Physical Volume(1) = {1};
// Four "terminals" of the model
Physical Surface(70) = {36};
Physical Surface(71) = {44};
Physical Surface(72) = {52};
Physical Surface(73) = {60};
// Whole domain surface
bnd[] = Boundary{ Volume{1}; };
Physical Surface(80) = bnd[];
// Complement of the domain surface respect to the four terminals
bnd[] -= {36, 44, 52, 60};
Physical Surface(75) = bnd[];
// Create a mesh of the model
Mesh 3;
// Find generators of relative homology spaces of the domain modulo
// the four terminals. Save the generator chains to t13_hom.msh.
HomGen("t13_hom.msh") = {{1}, {70, 71, 72, 73}};
// Find the corresponding thin cuts, generators of relative homology
// spaces modulo the non-terminal domain surface. Save the cut chains
// to t13_hom.msh.
HomGen("t13_hom.msh") = {{1}, {75}};
// Find the corresponding thick cuts. Save the cut chains to
// t13_hom.msh.
HomCut("t13_hom.msh") = {{1}, {70, 71, 72, 73}};
// More examples:
// HomGen("t13_hom.msh") = {{1}, {}};
// HomGen("t13_hom.msh") = {{}, {}};
// HomGen("t13_hom.msh") = {{1}, {80}};
// HomGen("t13_hom.msh") = {{}, {80}};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment