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

get name of physical group

parent 48a2329f
Branches
Tags
No related merge requests found
This diff is collapsed.
...@@ -5415,28 +5415,16 @@ FExpr_Multi : ...@@ -5415,28 +5415,16 @@ FExpr_Multi :
{ {
$$ = GetAllElementaryEntityNumbers(3); $$ = GetAllElementaryEntityNumbers(3);
} }
| tPhysical tPoint tBIGSTR | tPhysical tPoint ListOfDoubleOrAll
{ {
if(!$3){
$$ = GetAllPhysicalEntityNumbers(0); $$ = GetAllPhysicalEntityNumbers(0);
} }
| tPhysical tLine tBIGSTR else{
{
$$ = GetAllPhysicalEntityNumbers(1);
}
| tPhysical tSurface tBIGSTR
{
$$ = GetAllPhysicalEntityNumbers(2);
}
| tPhysical tVolume tBIGSTR
{
$$ = GetAllPhysicalEntityNumbers(3);
}
| tPhysical tPoint '{' RecursiveListOfDouble '}'
{
$$ = List_Create(10, 1, sizeof(double)); $$ = List_Create(10, 1, sizeof(double));
for(int i = 0; i < List_Nbr($4); i++){ for(int i = 0; i < List_Nbr($3); i++){
double num; double num;
List_Read($4, i, &num); List_Read($3, i, &num);
PhysicalGroup *p = FindPhysicalGroup((int)num, MSH_PHYSICAL_POINT); PhysicalGroup *p = FindPhysicalGroup((int)num, MSH_PHYSICAL_POINT);
if(p){ if(p){
for(int j = 0; j < List_Nbr(p->Entities); j++){ for(int j = 0; j < List_Nbr(p->Entities); j++){
...@@ -5458,14 +5446,19 @@ FExpr_Multi : ...@@ -5458,14 +5446,19 @@ FExpr_Multi :
} }
} }
} }
List_Delete($4); List_Delete($3);
}
} }
| tPhysical tLine '{' RecursiveListOfDouble '}' | tPhysical tLine ListOfDoubleOrAll
{ {
if(!$3){
$$ = GetAllPhysicalEntityNumbers(1);
}
else{
$$ = List_Create(10, 1, sizeof(double)); $$ = List_Create(10, 1, sizeof(double));
for(int i = 0; i < List_Nbr($4); i++){ for(int i = 0; i < List_Nbr($3); i++){
double num; double num;
List_Read($4, i, &num); List_Read($3, i, &num);
PhysicalGroup *p = FindPhysicalGroup((int)num, MSH_PHYSICAL_LINE); PhysicalGroup *p = FindPhysicalGroup((int)num, MSH_PHYSICAL_LINE);
if(p){ if(p){
for(int j = 0; j < List_Nbr(p->Entities); j++){ for(int j = 0; j < List_Nbr(p->Entities); j++){
...@@ -5487,14 +5480,19 @@ FExpr_Multi : ...@@ -5487,14 +5480,19 @@ FExpr_Multi :
} }
} }
} }
List_Delete($4); List_Delete($3);
} }
| tPhysical tSurface '{' RecursiveListOfDouble '}' }
| tPhysical tSurface ListOfDoubleOrAll
{ {
if(!$3){
$$ = GetAllPhysicalEntityNumbers(2);
}
else{
$$ = List_Create(10, 1, sizeof(double)); $$ = List_Create(10, 1, sizeof(double));
for(int i = 0; i < List_Nbr($4); i++){ for(int i = 0; i < List_Nbr($3); i++){
double num; double num;
List_Read($4, i, &num); List_Read($3, i, &num);
PhysicalGroup *p = FindPhysicalGroup((int)num, MSH_PHYSICAL_SURFACE); PhysicalGroup *p = FindPhysicalGroup((int)num, MSH_PHYSICAL_SURFACE);
if(p){ if(p){
for(int j = 0; j < List_Nbr(p->Entities); j++){ for(int j = 0; j < List_Nbr(p->Entities); j++){
...@@ -5516,14 +5514,19 @@ FExpr_Multi : ...@@ -5516,14 +5514,19 @@ FExpr_Multi :
} }
} }
} }
List_Delete($4); List_Delete($3);
} }
| tPhysical tVolume '{' RecursiveListOfDouble '}' }
| tPhysical tVolume ListOfDoubleOrAll
{ {
if(!$3){
$$ = GetAllPhysicalEntityNumbers(3);
}
else{
$$ = List_Create(10, 1, sizeof(double)); $$ = List_Create(10, 1, sizeof(double));
for(int i = 0; i < List_Nbr($4); i++){ for(int i = 0; i < List_Nbr($3); i++){
double num; double num;
List_Read($4, i, &num); List_Read($3, i, &num);
PhysicalGroup *p = FindPhysicalGroup((int)num, MSH_PHYSICAL_VOLUME); PhysicalGroup *p = FindPhysicalGroup((int)num, MSH_PHYSICAL_VOLUME);
if(p){ if(p){
for(int j = 0; j < List_Nbr(p->Entities); j++){ for(int j = 0; j < List_Nbr(p->Entities); j++){
...@@ -5545,7 +5548,8 @@ FExpr_Multi : ...@@ -5545,7 +5548,8 @@ FExpr_Multi :
} }
} }
} }
List_Delete($4); List_Delete($3);
}
} }
| tPoint tIn tBoundingBox | tPoint tIn tBoundingBox
'{' FExpr ',' FExpr ',' FExpr ',' FExpr ',' FExpr ',' FExpr '}' '{' FExpr ',' FExpr ',' FExpr ',' FExpr ',' FExpr ',' FExpr '}'
...@@ -5980,7 +5984,6 @@ StringExprVar : ...@@ -5980,7 +5984,6 @@ StringExprVar :
strcpy($$, val.c_str()); strcpy($$, val.c_str());
Free($1); Free($1);
} }
| String__Index '.' tSTRING_Member_Float | String__Index '.' tSTRING_Member_Float
{ {
std::string out; std::string out;
...@@ -6002,7 +6005,6 @@ StringExprVar : ...@@ -6002,7 +6005,6 @@ StringExprVar :
Free($1); Free($1);
if (flag_tSTRING_alloc) Free($3); if (flag_tSTRING_alloc) Free($3);
} }
| tSTRING '[' FExpr ']' '.' tSTRING | tSTRING '[' FExpr ']' '.' tSTRING
{ {
std::string out; std::string out;
...@@ -6011,6 +6013,30 @@ StringExprVar : ...@@ -6011,6 +6013,30 @@ StringExprVar :
strcpy($$, out.c_str()); strcpy($$, out.c_str());
Free($1); Free($6); Free($1); Free($6);
} }
| tPhysical tPoint '{' FExpr '}'
{
std::string name = GModel::current()->getPhysicalName(0, (int)$4);
$$ = (char*)Malloc((name.size() + 1) * sizeof(char));
strcpy($$, name.c_str());
}
| tPhysical tLine '{' FExpr '}'
{
std::string name = GModel::current()->getPhysicalName(1, (int)$4);
$$ = (char*)Malloc((name.size() + 1) * sizeof(char));
strcpy($$, name.c_str());
}
| tPhysical tSurface '{' FExpr '}'
{
std::string name = GModel::current()->getPhysicalName(2, (int)$4);
$$ = (char*)Malloc((name.size() + 1) * sizeof(char));
strcpy($$, name.c_str());
}
| tPhysical tVolume '{' FExpr '}'
{
std::string name = GModel::current()->getPhysicalName(3, (int)$4);
$$ = (char*)Malloc((name.size() + 1) * sizeof(char));
strcpy($$, name.c_str());
}
; ;
StringExpr : StringExpr :
...@@ -6259,7 +6285,6 @@ StringExpr : ...@@ -6259,7 +6285,6 @@ StringExpr :
strcpy($$, val.c_str()); strcpy($$, val.c_str());
Free($3); Free($3);
} }
| tNameStruct LP NameStruct_Arg RP | tNameStruct LP NameStruct_Arg RP
{ {
std::string out; std::string out;
...@@ -6280,7 +6305,6 @@ NameStruct_Arg : ...@@ -6280,7 +6305,6 @@ NameStruct_Arg :
{ Struct_NameSpace = $1; $$ = $5; } { Struct_NameSpace = $1; $$ = $5; }
; ;
RecursiveListOfStringExprVar : RecursiveListOfStringExprVar :
StringExprVar StringExprVar
{ {
...@@ -6288,7 +6312,9 @@ RecursiveListOfStringExprVar : ...@@ -6288,7 +6312,9 @@ RecursiveListOfStringExprVar :
List_Add($$, &($1)); List_Add($$, &($1));
} }
| RecursiveListOfStringExprVar ',' StringExprVar | RecursiveListOfStringExprVar ',' StringExprVar
{ List_Add($$, &($3)); } {
List_Add($$, &($3));
}
; ;
StringIndex : StringIndex :
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment