[Gmsh] filter out elements according to type

Christophe Geuzaine geuzaine at gmail.com
Mon Apr 30 08:46:16 CEST 2018



> On 27 Apr 2018, at 08:52, andrew <armitatz at gmail.com> wrote:
> 
> Hi,
> thank you for your reply.
> I downloaded gmsh-3.0.7- dcaabc7b and I saw in the gmsh.cpp the following code
> 
> GMSH_API void gmsh::model::getType(const int dim,
>                                    const int tag,
>                                    std::string &type)
> {
>   if(!_isInitialized()){ throw -1; }
>   GEntity *ge = GModel::current()->getEntityByTag(dim, tag);
>   if(!ge){
>     Msg::Error("%s does not exist", _getEntityName(dim, tag).c_str());
>     throw 2;
>   }
>   type = ge->getTypeString();
> }
> 
> I tried to use the code to a geo script like
> 

This new function is in the C++/C/Python API - not yet in the .geo file language.


> L[]= "*";
> 
> tp="";
> 
> getType(1,L[0],tp);
> 
> but I get errors. How can I use it for getting the type in to the tp variable? I also tried different syntaxes but I always get errors.
> 
> kind regards
> 
> andrew
> 
> 
> 
> 
> 2018-04-26 11:01 GMT+03:00 Christophe Geuzaine <geuzaine at gmail.com <mailto:geuzaine at gmail.com>>:
> 
> 
>> On 25 Apr 2018, at 22:29, Christophe Geuzaine <geuzaine at gmail.com <mailto:geuzaine at gmail.com>> wrote:
>> 
>> 
>> Hi Andrew,
>> 
>> Not in the current version. This is something we might indeed want to add in the API.
> 
> I've added gmsh::model::getType() which return the string type of an entity ("Circle", etc.) - this could be used to filter the results.
> 
> Christophe
> 
> 
>> 
>> Christophe
>> 
>>> On 25 Apr 2018, at 17:57, andrew <armitatz at gmail.com <mailto:armitatz at gmail.com>> wrote:
>>> 
>>> Hi,
>>> 
>>> I would like to select in a model all the arcs that are in a surface. For example if I use the line
>>> 
>>> lines[]=Line "*";
>>> 
>>> I get all the lines in a model. Is there a similar 
>>> 
>>> circles[]=Circle "*"; or arcs[]=Arc "*";
>>> 
>>> command with I will be able to select the circular elements?
>>> 
>>> thank you in advance
>>> 
>>> andrew
>>> 
>>> _______________________________________________
>>> gmsh mailing list
>>> gmsh at onelab.info <mailto:gmsh at onelab.info>
>>> http://onelab.info/mailman/listinfo/gmsh <http://onelab.info/mailman/listinfo/gmsh>
>> 
> 
> 
> _______________________________________________
> gmsh mailing list
> gmsh at onelab.info
> http://onelab.info/mailman/listinfo/gmsh

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://onelab.info/pipermail/gmsh/attachments/20180430/691cb319/attachment-0001.html>


More information about the gmsh mailing list