Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gmsh
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Larry Price
gmsh
Commits
f0a88843
Commit
f0a88843
authored
15 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
fix parser (wrong syntax for peridoc surf) + dummy abaqus write
parent
8ad8120a
No related branches found
No related tags found
No related merge requests found
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
Geo/GModelIO_Mesh.cpp
+46
-0
46 additions, 0 deletions
Geo/GModelIO_Mesh.cpp
Parser/Gmsh.tab.cpp
+1567
-1585
1567 additions, 1585 deletions
Parser/Gmsh.tab.cpp
Parser/Gmsh.y
+19
-22
19 additions, 22 deletions
Parser/Gmsh.y
Parser/Gmsh.yy.cpp
+90
-35
90 additions, 35 deletions
Parser/Gmsh.yy.cpp
with
1722 additions
and
1642 deletions
Geo/GModelIO_Mesh.cpp
+
46
−
0
View file @
f0a88843
...
...
@@ -2975,6 +2975,52 @@ int GModel::writeDIFF(const std::string &name, bool binary, bool saveAll,
return
1
;
}
#if 0 // TODO check and test this
int GModel::writeAbaqus(const std::string &name, bool saveAll,
double scalingFactor)
{
FILE *fp = fopen(name.c_str(), "w");
if(!fp){
Msg::Error("Unable to open file '%s'", name.c_str());
return 0;
}
if(noPhysicalGroups()) saveAll = true;
int numVertices = indexMeshVertices(saveAll);
fprintf(fp, "*Heading\n");
fprintf(fp, " %s\n", name.c_str());
fprintf(fp, "*Node\n");
for(unsigned int i = 0; i < entities.size(); i++)
if(entities[i]->physicals.size() || saveAll)
for(unsigned int j = 0; j < entities[i]->getNumMeshVertices(); j++){
MVertex *v = entities[i]->getNumMeshVertex(j);
fprintf(fp, "%d, %g, %g, %g\n", v->getIndex(), v->x(), v->y(), v->z());
}
int ne = 1;
for(unsigned int i = 0; i < entities.size(); i++)
if(entities[i]->physicals.size() || saveAll){
if(entities[i]->getNumMeshElements()){
MElement *e = entities[i]->getMeshElement(0);
fprintf(fp, "*Element, type=C3D4, ELSET=PART%d\n", entities[i]->tag());
for(unsigned int j = 0; j < entities[i]->getNumMeshElements(); j++){
MElement *e = entities[i]->getNumMeshElement(j);
fprintf(fp, "%d", ne++);
for(int k = 0; k < e->getNumVertices(); k++)
fpritnf(fp, ", %d", e->getVertex(k)->getIndex());
fprintf(fp, "\n");
}
}
}
fclose(fp);
return 1;
}
#endif
GModel
*
GModel
::
createGModel
(
std
::
map
<
int
,
MVertex
*>
&
vertexMap
,
std
::
vector
<
int
>
&
elementNum
,
std
::
vector
<
std
::
vector
<
int
>
>
&
vertexIndices
,
...
...
This diff is collapsed.
Click to expand it.
Parser/Gmsh.tab.cpp
+
1567
−
1585
View file @
f0a88843
This diff is collapsed.
Click to expand it.
Parser/Gmsh.y
+
19
−
22
View file @
f0a88843
...
...
@@ -1126,7 +1126,6 @@ Shape :
}
}
}
| tSpline '(' FExpr ')' tAFFECT ListOfDouble tEND
{
int num = (int)$3;
...
...
@@ -3248,22 +3247,23 @@ Periodic :
List_Delete($3);
List_Delete($5);
}
| tPeriodic tSurface FExpr ListOfDouble tAFFECT FExpr ListOfDouble tEND
| tPeriodic tSurface FExpr
'{' Recursive
ListOfDouble
'}'
tAFFECT FExpr
'{' Recursive
ListOfDouble
'}'
tEND
{
if (List_Nbr($4) != List_Nbr($7)){
yymsg(0, "Periodic Surface : the number of masters (%d) is not equal to the number of slaves(%d)", List_Nbr($4),List_Nbr($7));
if (List_Nbr($5) != List_Nbr($10)){
yymsg(0, "Periodic Surface: the number of masters (%d) is not equal to the number of slaves(%d)",
List_Nbr($5), List_Nbr($10));
}
double d_master = $3
,d_slave = $
6
;
double d_master = $3,
d_slave = $
8
;
int j_master = (int)d_master;
int j_slave = (int)d_slave;
Surface *s_slave = FindSurface(abs(j_slave));
if(s_slave){
s_slave->meshMaster = j_master;
for (int i
=0;i<
List_Nbr($
4
);i++){
for (int i
= 0; i <
List_Nbr($
5
);
i++){
double dm, ds;
List_Read($
4,
i,&dm);
List_Read($
7,
i,&ds);
List_Read($
5,
i,
&dm);
List_Read($
10,
i,
&ds);
s_slave->edgeCounterparts[(int)ds] = (int)dm;
}
}
...
...
@@ -3271,18 +3271,15 @@ Periodic :
GFace *gf = GModel::current()->getFaceByTag(abs(j_slave));
if(gf) gf->setMeshMaster(j_master);
else yymsg(0, "Unknown surface %d", j_slave);
for (int i=0;i<List_Nbr($4);i++){
for (int i = 0; i < List_Nbr($5); i++){
double dm, ds;
List_Read($
4,
i,&dm);
List_Read($
7,
i,&ds);
List_Read($
5,
i,
&dm);
List_Read($
10,
i,
&ds);
gf->edgeCounterparts[(int)ds] = (int)dm;
}
}
List_Delete($4);
List_Delete($7);
List_Delete($5);
List_Delete($10);
}
;
...
...
This diff is collapsed.
Click to expand it.
Parser/Gmsh.yy.cpp
+
90
−
35
View file @
f0a88843
...
...
@@ -6,10 +6,29 @@
/* A lexical scanner generated by flex */
#define yy_create_buffer gmsh_yy_create_buffer
#define yy_delete_buffer gmsh_yy_delete_buffer
#define yy_flex_debug gmsh_yy_flex_debug
#define yy_init_buffer gmsh_yy_init_buffer
#define yy_flush_buffer gmsh_yy_flush_buffer
#define yy_load_buffer_state gmsh_yy_load_buffer_state
#define yy_switch_to_buffer gmsh_yy_switch_to_buffer
#define yyin gmsh_yyin
#define yyleng gmsh_yyleng
#define yylex gmsh_yylex
#define yylineno gmsh_yylineno
#define yyout gmsh_yyout
#define yyrestart gmsh_yyrestart
#define yytext gmsh_yytext
#define yywrap gmsh_yywrap
#define yyalloc gmsh_yyalloc
#define yyrealloc gmsh_yyrealloc
#define yyfree gmsh_yyfree
#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 5
#define YY_FLEX_SUBMINOR_VERSION 3
3
#define YY_FLEX_SUBMINOR_VERSION 3
5
#if YY_FLEX_SUBMINOR_VERSION > 0
#define FLEX_BETA
#endif
...
...
@@ -31,7 +50,7 @@
/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
#if __STDC_VERSION__ >= 199901L
#if
defined (__STDC_VERSION__) &&
__STDC_VERSION__ >= 199901L
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
* if you want the limit (max/min) macros for int types.
...
...
@@ -94,11 +113,12 @@ typedef unsigned int flex_uint32_t;
#else
/* ! __cplusplus */
#if __STDC__
/* C99 requires __STDC__ to be defined as 1. */
#if defined (__STDC__)
#define YY_USE_CONST
#endif
/* __STDC__ */
#endif
/*
defined (
__STDC__
)
*/
#endif
/* ! __cplusplus */
#ifdef YY_USE_CONST
...
...
@@ -152,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
;
...
...
@@ -178,16 +203,6 @@ extern FILE *gmsh_yyin, *gmsh_yyout;
#define unput(c) yyunput( c, (yytext_ptr) )
/* The following is because we cannot portably get our hands on size_t
* (without autoconf's help, which isn't available because we want
* flex-generated scanners to compile on their own).
*/
#ifndef YY_TYPEDEF_YY_SIZE_T
#define YY_TYPEDEF_YY_SIZE_T
typedef
unsigned
int
yy_size_t
;
#endif
#ifndef YY_STRUCT_YY_BUFFER_STATE
#define YY_STRUCT_YY_BUFFER_STATE
struct
yy_buffer_state
...
...
@@ -205,7 +220,7 @@ struct yy_buffer_state
/* Number of characters read into yy_ch_buf, not including EOB
* characters.
*/
in
t
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
...
...
@@ -275,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
in
t
yy_n_chars
;
/* number of characters read into yy_ch_buf */
in
t
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
;
...
...
@@ -304,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
,
in
t
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
);
...
...
@@ -895,7 +910,7 @@ void skipline(void);
#define YY_NO_UNISTD_H
#endif
#line
899
"Gmsh.yy.cpp"
#line
914
"Gmsh.yy.cpp"
#define INITIAL 0
...
...
@@ -913,6 +928,35 @@ void skipline(void);
static
int
yy_init_globals
(
void
);
/* Accessor methods to globals.
These are made visible to non-reentrant scanners for convenience. */
int
gmsh_yylex_destroy
(
void
);
int
gmsh_yyget_debug
(
void
);
void
gmsh_yyset_debug
(
int
debug_flag
);
YY_EXTRA_TYPE
gmsh_yyget_extra
(
void
);
void
gmsh_yyset_extra
(
YY_EXTRA_TYPE
user_defined
);
FILE
*
gmsh_yyget_in
(
void
);
void
gmsh_yyset_in
(
FILE
*
in_str
);
FILE
*
gmsh_yyget_out
(
void
);
void
gmsh_yyset_out
(
FILE
*
out_str
);
yy_size_t
gmsh_yyget_leng
(
void
);
char
*
gmsh_yyget_text
(
void
);
int
gmsh_yyget_lineno
(
void
);
void
gmsh_yyset_lineno
(
int
line_number
);
/* Macros after this point can all be overridden by user definitions in
* section 1.
*/
...
...
@@ -955,7 +999,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
(void)
fwrite( gmsh_yytext, gmsh_yyleng, 1, gmsh_yyout )
#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,
...
...
@@ -966,7 +1010,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; \
...
...
@@ -1051,7 +1095,7 @@ YY_DECL
#line 49 "Gmsh.l"
#line 10
55
"Gmsh.yy.cpp"
#line 10
99
"Gmsh.yy.cpp"
if
(
!
(
yy_init
)
)
{
...
...
@@ -1891,7 +1935,7 @@ YY_RULE_SETUP
#line 227 "Gmsh.l"
ECHO
;
YY_BREAK
#line 1
895
"Gmsh.yy.cpp"
#line 1
939
"Gmsh.yy.cpp"
case
YY_STATE_EOF
(
INITIAL
)
:
yyterminate
();
...
...
@@ -2077,7 +2121,7 @@ static int yy_get_next_buffer (void)
else
{
in
t
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
)
...
...
@@ -2091,7 +2135,7 @@ static int yy_get_next_buffer (void)
if
(
b
->
yy_is_our_buffer
)
{
in
t
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
;
...
...
@@ -2146,6 +2190,14 @@ static int yy_get_next_buffer (void)
else
ret_val
=
EOB_ACT_CONTINUE_SCAN
;
if
((
yy_size_t
)
((
yy_n_chars
)
+
number_to_move
)
>
YY_CURRENT_BUFFER_LVALUE
->
yy_buf_size
)
{
/* Extend the array by 50%, plus the number we really need. */
yy_size_t
new_size
=
(
yy_n_chars
)
+
number_to_move
+
((
yy_n_chars
)
>>
1
);
YY_CURRENT_BUFFER_LVALUE
->
yy_ch_buf
=
(
char
*
)
gmsh_yyrealloc
((
void
*
)
YY_CURRENT_BUFFER_LVALUE
->
yy_ch_buf
,
new_size
);
if
(
!
YY_CURRENT_BUFFER_LVALUE
->
yy_ch_buf
)
YY_FATAL_ERROR
(
"out of dynamic memory in yy_get_next_buffer()"
);
}
(
yy_n_chars
)
+=
number_to_move
;
YY_CURRENT_BUFFER_LVALUE
->
yy_ch_buf
[(
yy_n_chars
)]
=
YY_END_OF_BUFFER_CHAR
;
YY_CURRENT_BUFFER_LVALUE
->
yy_ch_buf
[(
yy_n_chars
)
+
1
]
=
YY_END_OF_BUFFER_CHAR
;
...
...
@@ -2224,7 +2276,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
in
t
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
=
...
...
@@ -2273,7 +2325,7 @@ static int yy_get_next_buffer (void)
else
{
/* need more input */
in
t
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
(
)
)
...
...
@@ -2549,7 +2601,7 @@ void gmsh_yypop_buffer_state (void)
*/
static
void
gmsh_yyensure_buffer_stack
(
void
)
{
in
t
num_to_alloc
;
yy_size_
t
num_to_alloc
;
if
(
!
(
yy_buffer_stack
))
{
...
...
@@ -2561,6 +2613,8 @@ static void gmsh_yyensure_buffer_stack (void)
(
yy_buffer_stack
)
=
(
struct
yy_buffer_state
**
)
gmsh_yyalloc
(
num_to_alloc
*
sizeof
(
struct
yy_buffer_state
*
)
);
if
(
!
(
yy_buffer_stack
)
)
YY_FATAL_ERROR
(
"out of dynamic memory in gmsh_yyensure_buffer_stack()"
);
memset
((
yy_buffer_stack
),
0
,
num_to_alloc
*
sizeof
(
struct
yy_buffer_state
*
));
...
...
@@ -2579,6 +2633,8 @@ static void gmsh_yyensure_buffer_stack (void)
((
yy_buffer_stack
),
num_to_alloc
*
sizeof
(
struct
yy_buffer_state
*
)
);
if
(
!
(
yy_buffer_stack
)
)
YY_FATAL_ERROR
(
"out of dynamic memory in gmsh_yyensure_buffer_stack()"
);
/* zero only the new slots.*/
memset
((
yy_buffer_stack
)
+
(
yy_buffer_stack_max
),
0
,
grow_size
*
sizeof
(
struct
yy_buffer_state
*
));
...
...
@@ -2623,7 +2679,7 @@ YY_BUFFER_STATE gmsh_yy_scan_buffer (char * base, yy_size_t size )
/** Setup the input buffer state to scan a string. The next call to gmsh_yylex() will
* scan from a @e copy of @a str.
* @param str a NUL-terminated string to scan
* @param
yy
str a NUL-terminated string to scan
*
* @return the newly allocated buffer state object.
* @note If you want to scan bytes that may contain NUL values, then use
...
...
@@ -2642,12 +2698,11 @@ YY_BUFFER_STATE gmsh_yy_scan_string (yyconst char * yystr )
*
* @return the newly allocated buffer state object.
*/
YY_BUFFER_STATE
gmsh_yy_scan_bytes
(
yyconst
char
*
yybytes
,
in
t
_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
;
...
...
@@ -2729,7 +2784,7 @@ FILE *gmsh_yyget_out (void)
/** Get the length of the current token.
*
*/
in
t
gmsh_yyget_leng
(
void
)
yy_size_
t
gmsh_yyget_leng
(
void
)
{
return
gmsh_yyleng
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment