Page 1 of 1

[GiDlist] Re: how to count the number of 3D elems in a volum

Posted: Tue Apr 15, 2003 2:40 pm
by Andres Peratta
Enrique, thank you very much for your help.
I'd like to know if it is possible to assign the number of volumes
to a variable in a bas file.

For example, something like :
*set var N=tcl(Nvol)

where Nvol is this tcl procedure :

proc NVol { } {
set a [.central.s info list_entities Status]
regexp -nocase {number of volumes: ([0-9]+)} $a none num
return $num
}
------------------------------------------------------------------------

I'm still trying to build the table of volumes in the output file.
To do so, I included this condition in the .cnd file
which assigns volume labels to mesh elems:

NUMBER: 1 CONDITION: VolId
Question: Volume_Num#FUNC#(NumEntity)
Value:0
state: hidden
END CONDITION

------------------------------------------------------------------------
And here are the lines that I am trying to use
in my bas file, in order to get a table of volumes and their number of elems
as an output.
This would work provided that the variable Nvol is initialized with the
number of volumes created in the project, and this is what I don't know how
to do.

*set elems(Tetrahedra)
*set cond VolId
*for(vol=1;vol=Nvol;vol=vol+1)
*set var NelemsVol=0
*loop elems
*if(cond(1,int) == vol)
*set var NelemsVol = NelemsVol + 1
*end if
*end
Volume = *vol ; Number of elems = *NelemsVol
*end

-------------------------------------------------------------------------

In general, is there any way to assign the result of a tcl function to a variable in a bas file ?

Sorry to bother you, and thank you very much for your help
best regards,
Andres

[GiDlist] Re: how to count the number of 3D elems in a volum

Posted: Tue Apr 15, 2003 3:53 pm
by Enrique Escolano
Sorry, by now is not available to return a value from a tcl procedure to a
*bas variable.

To solve your problem, you can ask GiD about the applied conditions, from a
tcl procedure,
instead from the bas file, then reorder this information and print as
desired
(the tcl returned value is printed directly to the output file).

Enrique Escolano

----- Original Message -----
From: "Andres Peratta" andres at wessex.ac.uk
To: gidlist at gatxan.cimne.upc.es
Sent: Tuesday, April 15, 2003 2:33 PM
Subject: [GiDlist] Re: how to count the number of 3D elems in a volume


Enrique, thank you very much for your help.
I'd like to know if it is possible to assign the number of volumes
to a variable in a bas file.

For example, something like :
*set var N=tcl(Nvol)

where Nvol is this tcl procedure :

proc NVol { } {
set a [.central.s info list_entities Status]
regexp -nocase {number of volumes: ([0-9]+)} $a none num
return $num
}
------------------------------------------------------------------------

I'm still trying to build the table of volumes in the output file.
To do so, I included this condition in the .cnd file
which assigns volume labels to mesh elems:

NUMBER: 1 CONDITION: VolId
Question: Volume_Num#FUNC#(NumEntity)
Value:0
state: hidden
END CONDITION

------------------------------------------------------------------------
And here are the lines that I am trying to use
in my bas file, in order to get a table of volumes and their number of
elems
as an output.
This would work provided that the variable Nvol is initialized with the
number of volumes created in the project, and this is what I don't know
how
to do.

*set elems(Tetrahedra)
*set cond VolId
*for(vol=1;vol=Nvol;vol=vol+1)
*set var NelemsVol=0
*loop elems
*if(cond(1,int) == vol)
*set var NelemsVol = NelemsVol + 1
*end if
*end
Volume = *vol ; Number of elems = *NelemsVol
*end

-------------------------------------------------------------------------

In general, is there any way to assign the result of a tcl function to a
variable in a bas file ?

Sorry to bother you, and thank you very much for your help
best regards,
Andres


_______________________________________________
GiDlist mailing list
GiDlist at gid.cimne.upc.es
http://gid.cimne.upc.es/mailman/listinfo/gidlist