Welcome to the forums. Please post in English or French.

You are not logged in.

#1 2013-01-15 10:08:36

humbert
Member
From: Seoul
Registered: 2007-11-26
Posts: 81
Website

[SOLVED] Bug CREA_TABLE / RESU / NOEUD avec liste de noeud

Enjoy!


    depl_tab = CREA_TABLE(
        RESU = _F(
            RESULTAT   = U1,
            NOM_CHAM   = 'DEPL',
            #TOUT_ORDRE = 'OUI',
            NOM_CMP    = ('DX','DY','DZ','DRX','DRY','DRZ'),
            NOEUD      =  voir ci-dessous...,
        ),
    )




  # ------------------------------------------------------------------------------------------
  # Commande No :  0029            Concept de type : table_sdaster
  # ------------------------------------------------------------------------------------------
  depl_tab=CREA_TABLE(TYPE_TABLE='TABLE',
                      RESU=_F(NOEUD=('N50     ','N116    ','N900    ','N74     ','N100    ','N916    ','N2100   ','N2900   ',),
                              CRITERE='RELATIF',
                              RESULTAT=U1,
                              NOM_CHAM='DEPL',
                              NOM_CMP=('DX','DY','DZ','DRX','DRY','DRZ',),
                              PRECISION=1.E-06),
                      );

! Etape  : CREA_TABLE / RESU / NOEUD
! Parent : fort.1
! ERREUR incoherence fortran/catalogue de commande, chaine de caractres attendue et non :
! ('N50     ', 'N116    ', 'N900    ', 'N74     ', 'N100    ', 'N916    ', 'N2100   ', 'N2900   ')
<F> GETVTX : numero d'occurence (IOCC=1)
             commande : CREA_TABLE
             mot-cle facteur : RESU
             mot-cle simple  : NOEUD
/opt/aster/STA11.1/bibc/supervis/astermodule.c 1355 : erreur dans la partie Python
Traceback (most recent call last):
  File "./Python/Build/B_ETAPE.py", line 228, in getvtx
    raise AssertionError
AssertionError
Aborted (core dumped)


Differents tests:

1) NOEUD = ('N50     ','N116', etc...),  => ok

x = ('N50     ','N116', etc...)
2) NOEUD = x,   => coredump
3) NOEUD = (x), => ok
4) NOEUD = (x,),   => coredump

x = []
x.append('N50     ')
x.append('N116    ')
etc...
5) NOEUD = x,   => coredump
6) NOEUD = (x), => coredump
7) NOEUD = (x,),   => coredump

2 et 5 devraient marcher...
3 est complètement aberrant
j'ai essaye aussi en forçant le type avec tuple(x) ou list(x), ça change rien.

Conclusion: si on écrit la liste a la main dans le .comm ça passe, si on la crée iterativement avec Python ça coredump.

Last edited by humbert (2013-01-25 08:42:03)

Offline

#2 2013-01-16 06:55:03

humbert
Member
From: Seoul
Registered: 2007-11-26
Posts: 81
Website

Re: [SOLVED] Bug CREA_TABLE / RESU / NOEUD avec liste de noeud

Apparemment le problème ne vient pas de CREA_TABLE mais plutôt de "getvtx_": même problème avec une liste Python de noms de noeuds passée à NOEUD dans DEFI_GROUP (c'était une tentative de workaround).


* comm:

    list_no = []
    for no_num in list_no_num:
        list_no.append(node_names[no_num - 1])

    MA = DEFI_GROUP(
        reuse    = MA,
        MAILLAGE = MA,
        CREA_GROUP_NO = _F(
            NOM   = 'TMPGRPNO',
            NOEUD = list_no,
        ),
    )


* mess:

MA=DEFI_GROUP(reuse = MA,
                MAILLAGE=MA,
                CREA_GROUP_NO=_F(NOEUD=('N50     ','N116    ','N900    ','N74     ','N100    ','N916    ','N2100   ','N2900   ',),
                                 NOM='TMPGRPNO'),
                ALARME='OUI',
                );

! Etape  : DEFI_GROUP / CREA_GROUP_NO / NOEUD
! Parent : fort.1
! ERREUR incoherence fortran/catalogue de commande, chaine de caractres attendue et non :
! ['N50     ', 'N116    ', 'N900    ', 'N74     ', 'N100    ', 'N916    ', 'N2100   ', 'N2900   ']
<F> GETVTX : numero d'occurence (IOCC=1)
             commande : DEFI_GROUP
             mot-cle facteur : CREA_GROUP_NO
             mot-cle simple  : NOEUD


* Coredump:

#0  0x00007f243fad1425 in __GI_raise (sig=<optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
64    ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
#0  0x00007f243fad1425 in __GI_raise (sig=<optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#1  0x00007f243fad4b8b in __GI_abort () at abort.c:91
#2  0x000000000050038b in TraiteMessageErreur (message=0x7597dc0 "/opt/aster/STA11.1/bibc/supervis/astermodule.c 1355 : erreur dans la partie Python") at /opt/aster/STA11.1/bibc/supervis/astermodule.c:263
#3  0x000000000050046e in PRE_myabort (nomFichier=0x2456860 "/opt/aster/STA11.1/bibc/supervis/astermodule.c", numeroLigne=1355, message=0x245683d "erreur dans la partie Python") at /opt/aster/STA11.1/bibc/supervis/astermodule.c:296
#4  0x0000000000502da2 in getvtx_ (motfac=0x7fffcc926d70 "CREA_GROUP_NO   GROUP_MA        &&SSCGNO.LISTE_NOEUDS   \001", motcle=0x24926b0 "NOEUDINTERSECUNIONDIFFEGROUP_MATOUT_GROUP_MAGROUP_NOOPTIONNOMSOUSTRUC_37FLONUTIINTEROUISOUSTRUC_38ALONMAXEENV_SPHEREENV_CYLINDREPLANSEGM_DROI_ORDOTUNNELINCLUSIONNOEUD_ORDOOUVERTVFISS_XFEMCALCULEL6_10."..., iocc=0x7fffcc926de8, iarg=0x7fffcc926e48, mxval=0x24926a8, txval=0x7fffcc926dc0 "MA      -\364\035", nbval=0x7fffcc926d58, lfac=16, lcle=5, ltx=8) at /opt/aster/STA11.1/bibc/supervis/astermodule.c:1355
#5  0x000000000093e136 in sscgno (ma=..., nbgnin=6, _ma=8) at /opt/aster/STA11.1/bibfor/soustruc/sscgno.f:90
#6  0x00000000006ec380 in op0104 () at /opt/aster/STA11.1/bibfor/soustruc/op0104.f:163
etc...

Offline

#3 2013-01-16 08:42:34

Archibald Archambaud
Member
From: Clamart, France
Registered: 2007-12-03
Posts: 322

Re: [SOLVED] Bug CREA_TABLE / RESU / NOEUD avec liste de noeud

Dear Humbert,

I tried to reproduce your problem without success. I used the stable and unstable versions.

I am afraid something is wrong in your installation. Perhaps try to rebuild a fresh version.

AA

Offline

#4 2013-01-16 08:49:36

humbert
Member
From: Seoul
Registered: 2007-11-26
Posts: 81
Website

Re: [SOLVED] Bug CREA_TABLE / RESU / NOEUD avec liste de noeud

Sorry I forgot to mention this but you need to define the Python list at the root of the command script, but call the DEFI_GROUP or CREA_TABLE command inside a Python function. Otherwise indeed it works.

Could you try the following please?


# 1) Define Python list
x = ('N50     ','N116    ','N900    ','N74     ','N100    ','N916    ','N2100   ','N2900   ',)

# 2) Create Python function with a command
def www(MA, xx):
   
    z = []
    for s in xx:
        z.append(s)
   
    MA = DEFI_GROUP(
        reuse    = MA,
        MAILLAGE = MA,
        CREA_GROUP_NO = _F(
            NOM   = 'TMPGRPNO',
            NOEUD = z,
        ),
    )

# 3) Call the Python function
www(MA, x)

-> coredump

Offline

#5 2013-01-16 13:13:09

Archibald Archambaud
Member
From: Clamart, France
Registered: 2007-12-03
Posts: 322

Re: [SOLVED] Bug CREA_TABLE / RESU / NOEUD avec liste de noeud

Dear Humbert,

I tried the following code on the foma01a test case. It runs fine on my installation.
Can you give it a try.

AA

def function(x):
    z = []
    for s in x:
        z.append(s)
    
    depl_tab = CREA_TABLE(RESU=_F(RESULTAT   = RESU,
                                  NOM_CHAM   = 'DEPL',
                                  NOM_CMP    = ('DX','DY','DZ',),
                                  NOEUD      =  z,
                                  ),
        )


DEBUT(PAR_LOT='NON',)

MA=DEFI_MATERIAU(ELAS=_F(E=200000.0,
                         NU=0.3,),);

MAIL=LIRE_MAILLAGE(FORMAT='MED',);

MODE=AFFE_MODELE(MAILLAGE=MAIL,
                 AFFE=_F(TOUT='OUI',
                         PHENOMENE='MECANIQUE',
                         MODELISATION='C_PLAN',),);

MAIL=MODI_MAILLAGE(reuse =MAIL,
                   MAILLAGE=MAIL,
                   ORIE_PEAU_2D=_F(GROUP_MA='haut',),);

MATE=AFFE_MATERIAU(MAILLAGE=MAIL,
                   AFFE=_F(TOUT='OUI',
                           MATER=MA,),);

CHAR=AFFE_CHAR_MECA(MODELE=MODE,
                    DDL_IMPO=(_F(GROUP_MA='bas',
                                 DY=0.0,),
                              _F(GROUP_MA='gauche',
                                 DX=0.0,),),
                    PRES_REP=_F(GROUP_MA='haut',
                                PRES=-100.0,),);

RESU=MECA_STATIQUE(MODELE=MODE,
                   CHAM_MATER=MATE,
                   EXCIT=_F(CHARGE=CHAR,),);


xx=('N1','N2')
function(xx)

FIN();

Offline

#6 2013-01-17 01:15:24

humbert
Member
From: Seoul
Registered: 2007-11-26
Posts: 81
Website

Re: [SOLVED] Bug CREA_TABLE / RESU / NOEUD avec liste de noeud

Obviously (I could have told by reading the code alone) I've got the undefined error below.
By the way I'm using version 11.1 on Ubuntu 12.04 with Python 2.7.3. You said it runs fine for you, is this got corrected in later versions? Because this behavior (undefined name in function declaration) has always been a big issue for me, whatever the version. I never ran fine any code like this, and so do all people I know on whatever version / platform (below v11.1).


ERREUR A L'INTERPRETATION DANS ACCAS - INTERRUPTION
>> DEBUT RAPPORT
CR phase d'initialisation
   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
   ! erreur de syntaxe,  Erreur de nom: name 'RESU' is not defined ligne 6 !
   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
fin CR phase d'initialisation

>> FIN RAPPORT
ERREUR A LA VERIFICATION SYNTAXIQUE - INTERRUPTION
>> DEBUT RAPPORT
DEBUT CR validation : fort.1
   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
   ! - Il faut au moins un mot-cl parmi : ('DEBUT', 'POURSUITE')                   !
   ! - Il faut au moins un mot-cl parmi : ('FIN',)                                 !
   ! - Il faut qu'au moins un objet de la liste : ('DEBUT', 'POURSUITE') soit suivi !
   ! d'au moins un objet de la liste : ('FIN',)                                     !
   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
   ! erreur de syntaxe,  Erreur de nom: name 'RESU' is not defined ligne 6 !
   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
FIN CR validation :fort.1

>> FIN RAPPORT

Last edited by humbert (2013-01-17 01:15:39)

Offline

#7 2013-01-17 03:04:06

humbert
Member
From: Seoul
Registered: 2007-11-26
Posts: 81
Website

Re: [SOLVED] Bug CREA_TABLE / RESU / NOEUD avec liste de noeud

Same error with a fresh new install of version 11.3.0-2 just downloaded:

ERREUR A L'INTERPRETATION DANS ACCAS - INTERRUPTION
>> JDC.py : DEBUT RAPPORT
CR phase d'initialisation
   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
   ! erreur de syntaxe,  Erreur de nom: name 'RESU' is not defined ligne 6 !
   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
fin CR phase d'initialisation

>> JDC.py : FIN RAPPORT

Offline

#8 2013-01-17 07:43:26

jeanpierreaubry
Guru
From: nantes (france)
Registered: 2009-03-12
Posts: 3,975

Re: [SOLVED] Bug CREA_TABLE / RESU / NOEUD avec liste de noeud

hello

Archibald's example works flawless on my 10.8 install,
and with the following line added the table gets printed
IMPR_TABLE (TABLE=depl_tab,)
it works just as well on 11.3

this on openSuSE 12.2

however one question
while running a case the Python that is used is the one lying in $ASTER_ROOT is not it?

jean pierre aubry


consider reading my book
freely available here https://framabook.org/beginning-with-code_aster/

Online

#9 2013-01-17 11:11:45

Archibald Archambaud
Member
From: Clamart, France
Registered: 2007-12-03
Posts: 322

Re: [SOLVED] Bug CREA_TABLE / RESU / NOEUD avec liste de noeud

Jean-Pierre, thank you for confirming you do not encounter problems with the test. FYI, the Python that is used is the one specified in you config.txt file.

Humbert, I am afraid you have a problem on your system. I am using Ubuntu 12.04 with Python 2.7.

AA

Offline

#10 2013-01-18 02:00:11

humbert
Member
From: Seoul
Registered: 2007-11-26
Posts: 81
Website

Re: [SOLVED] Bug CREA_TABLE / RESU / NOEUD avec liste de noeud

My bad, I messed the indentation in the copy-paste from the forum. The CREA_TABLE was not idented and got outside the function, which then makes it perfectly logical why I had an error. Now this particular example (forma01a) works flawlessly.
Now on why mine do not...

Offline

#11 2013-01-18 05:41:41

humbert
Member
From: Seoul
Registered: 2007-11-26
Posts: 81
Website

Re: [SOLVED] Bug CREA_TABLE / RESU / NOEUD avec liste de noeud

OK I found the reason, which may or may not be considered a bug (your call): my list of strings has strings of type 'numpy.string_' (NumPy strings) and not 'str' (pure Python strings) because I was manipulating arrays with NumPy. I added a conversion str(...) arount the node names and it works.

Now, for the 'bug' nature of the error, I suggest if I may that the behavior would be made consistent between the validator and the Fortran code, which probably both have a different interpretation of whether a NumPy string argument is a valid Fortran string argument (so to speak). And since NumPy is so heavily used by Code_Aster (strong dependency), it could accept NumPy strings in place of regular Python strings.

If you consider this is not a bug please let me know, I'll prepend a [SOLVED] in the forum thread title.

Offline

#12 2013-01-18 15:07:52

mathieu.courtois
Administrator
From: France
Registered: 2007-11-21
Posts: 1,183

Re: [SOLVED] Bug CREA_TABLE / RESU / NOEUD avec liste de noeud

Hello,

Two different checks of type may fail depending of the expected type: TXM=normal text, grma=names of mesh elements (or group of).

This elementary example shows the failure and the different error messages (to work it requires a mesh with two nodes N3 & N7).

I'll post a bug in our bugtracker and will fix it soon.


Important for all the reader: when you encounter an error, reproduce it on the smallest .comm file will make it fixed very soon!

MC


Attachments:
numpy_str.comm, Size: 1.02 KiB, Downloads: 389

Code_Aster release : last unstable on Ubuntu 16.04 64 bits - GNU Compilers

Please do not forget to tag your first post as *SOLVED* when it is!

Offline

#13 2013-01-18 18:15:36

mathieu.courtois
Administrator
From: France
Registered: 2007-11-21
Posts: 1,183

Re: [SOLVED] Bug CREA_TABLE / RESU / NOEUD avec liste de noeud

The issue in our bugtracker has the number #20220.

Check the histor files to know when it will be fixed :
http://www.code-aster.org/V2/spip.php?article16

MC


Code_Aster release : last unstable on Ubuntu 16.04 64 bits - GNU Compilers

Please do not forget to tag your first post as *SOLVED* when it is!

Offline

#14 2013-01-25 08:41:23

humbert
Member
From: Seoul
Registered: 2007-11-26
Posts: 81
Website

Re: [SOLVED] Bug CREA_TABLE / RESU / NOEUD avec liste de noeud

OK thank you Mathieu.

Offline