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

allow Physicals as right values in FExprs

parent 45de44ed
No related branches found
No related tags found
No related merge requests found
Source diff could not be displayed: it is too large. Options to address this: view the blob.
...@@ -4219,6 +4219,78 @@ FExpr_Multi : ...@@ -4219,6 +4219,78 @@ FExpr_Multi :
{ {
$$ = GetAllEntityNumbers(3); $$ = GetAllEntityNumbers(3);
} }
| tPhysical tPoint '{' RecursiveListOfDouble '}'
{
$$ = List_Create(10, 1, sizeof(double));
for(int i = 0; i < List_Nbr($4); i++){
double num;
List_Read($4, i, &num);
PhysicalGroup *p = FindPhysicalGroup((int)num, MSH_PHYSICAL_POINT);
if(p){
for(int j = 0; j < List_Nbr(p->Entities); j++){
int nume;
List_Read(p->Entities, j, &nume);
double d = nume;
List_Add($$, &d);
}
}
}
List_Delete($4);
}
| tPhysical tLine '{' RecursiveListOfDouble '}'
{
$$ = List_Create(10, 1, sizeof(double));
for(int i = 0; i < List_Nbr($4); i++){
double num;
List_Read($4, i, &num);
PhysicalGroup *p = FindPhysicalGroup((int)num, MSH_PHYSICAL_LINE);
if(p){
for(int j = 0; j < List_Nbr(p->Entities); j++){
int nume;
List_Read(p->Entities, j, &nume);
double d = nume;
List_Add($$, &d);
}
}
}
List_Delete($4);
}
| tPhysical tSurface '{' RecursiveListOfDouble '}'
{
$$ = List_Create(10, 1, sizeof(double));
for(int i = 0; i < List_Nbr($4); i++){
double num;
List_Read($4, i, &num);
PhysicalGroup *p = FindPhysicalGroup((int)num, MSH_PHYSICAL_SURFACE);
if(p){
for(int j = 0; j < List_Nbr(p->Entities); j++){
int nume;
List_Read(p->Entities, j, &nume);
double d = nume;
List_Add($$, &d);
}
}
}
List_Delete($4);
}
| tPhysical tVolume '{' RecursiveListOfDouble '}'
{
$$ = List_Create(10, 1, sizeof(double));
for(int i = 0; i < List_Nbr($4); i++){
double num;
List_Read($4, i, &num);
PhysicalGroup *p = FindPhysicalGroup((int)num, MSH_PHYSICAL_VOLUME);
if(p){
for(int j = 0; j < List_Nbr(p->Entities); j++){
int nume;
List_Read(p->Entities, j, &nume);
double d = nume;
List_Add($$, &d);
}
}
}
List_Delete($4);
}
| Transform | Transform
{ {
$$ = List_Create(List_Nbr($1), 1, sizeof(double)); $$ = List_Create(List_Nbr($1), 1, sizeof(double));
......
...@@ -1336,6 +1336,7 @@ List of expressions are also widely used, and are defined as: ...@@ -1336,6 +1336,7 @@ List of expressions are also widely used, and are defined as:
@var{extrude} @var{extrude}
Point @{ @var{expression} @} | Point @{ @var{expression} @} |
Point|Line|Surface|Volume "*" | Point|Line|Surface|Volume "*" |
Physical Point|Line|Surface|Volume @{ @var{expression-list} @}
@c @var{duplicata} - already implemented: should we explain this? @c @var{duplicata} - already implemented: should we explain this?
@end example @end example
...@@ -1350,10 +1351,11 @@ permits to reference an expression sublist (whose elements are those ...@@ -1350,10 +1351,11 @@ permits to reference an expression sublist (whose elements are those
corresponding to the indices provided by the @var{expression-list}). corresponding to the indices provided by the @var{expression-list}).
The next two cases permit to retrieve the indices of entities created The next two cases permit to retrieve the indices of entities created
through geometrical transformations and extrusions (see through geometrical transformations and extrusions (see
@ref{Transformations}, and @ref{Extrusions}). The last two cases permit @ref{Transformations}, and @ref{Extrusions}). The last three cases
to retrieve the coordinates of a given geometry point (@pxref{Points}), permit to retrieve the coordinates of a given geometry point
or to retrieve the id numbers of all points, lines, surfaces or volumes (@pxref{Points}), to retrieve the id numbers of all points, lines,
in the model. surfaces or volumes in the model, or to retrieve the elementary entities
making up physical groups.
To see the practical use of such expressions, have a look at the first To see the practical use of such expressions, have a look at the first
couple of examples in @ref{Tutorial}. Note that, in order to lighten the couple of examples in @ref{Tutorial}. Note that, in order to lighten the
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment