Help migration ? set_less__char__greater_()

26 views
Skip to first unread message

Olivier Miramand

unread,
Mar 3, 2026, 6:11:40 AM (8 days ago) Mar 3
to FeResPost
Hello,

Please, someone can help be to migrate my code from old version I used:
def getResultValues(self, lcName, scName, tName, group, selectionMethod = "Elements"):
        intSet = pyferespost.set_less__int__greater_()
        strSet = pyferespost.set_less__char__greater_()
resultCopy = pyferespost.result()
 mydb.getResultCopy(resultCopy, lcName, scName, tName, selectionMethod, group, intSet, strSet)


My problem is what replace set_less__int__greater_() and set_less__char__greater_()
in the last library

My preview library is from python 2 ! (I think FeResPost 4.5.7)

Thank you for your help

BR
Olivier

FeResPost

unread,
Mar 3, 2026, 12:25:10 PM (7 days ago) Mar 3
to FeResPost
Hi Olivier,

I think your difficulties are related to the fact you are migrating an old version of FeResPost with "private" Python bindings developed independently of the official versions of FeResPost. Methods  set_less__int__greater_() and set_less__char__greater_() have never been in the source code of official Python bindings.

The first official FeResPost library with Python bindings is version 4.4.0.

If I am right, you must choose between two possible solution:
  • Either you adopt the official Python bindings and abandon your private ones.
  • Or you keep your bindings and adapt them to more recent versions of FeResPost.
The second solution allows you to keep all the developments that have been done indpendently of the official version. But it might take a lot of work to modify your version and support more recent FeResPost developments. The first solution might take a lot of work on your Python scripts.

Regards,

Renaud
Message has been deleted

Olivier Miramand

unread,
Mar 3, 2026, 1:34:07 PM (7 days ago) Mar 3
to FeResPost
Hello,

Thank you for your answer.
I solved this first issue.
But now I have another strange problem with basic getData..
when I read op2 file with getResultCopy  and getData() I not the have the same number of value between my old version and the last:

Exemple:  db.getResultCopy("LOADCASE1", "Statics", "Beam Forces","Elements",[])

Old version return 13 values
[[189, -999, 'NONE', 'NONE', 6, 'elemCS', 715.0115966796875, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [190, -999, 'NONE', 'NONE', 6, 'elemCS', -218.2909698486328, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], ...

And new version return only 11 values
[[189, 'NONE', 'NONE', 0, 'elemCS', 715.0115966796875, 0.0, 0.0, 0.0, 0.0, 0.0], [190, 'NONE', 'NONE', 0, 'elemCS', -218.2909698486328, 0.0, 0.0, 0.0, 0.0, 0.0],

Do you think I miss something in the parameter ?

Thank You
Best regards,
Olivier

FeResPost

unread,
Mar 4, 2026, 12:41:17 PM (6 days ago) Mar 4
to FeResPost
Hello Olivier,

I prefer the new version with 11 values because each sub-array contains ten elements and not 11. Normally, Beam Forces are tensorial results, and components (real values) are returned for each element by the getData mehod.

The best way to check the output of your script and figure out what is correct is to compare the utputs with results you extract interactively with Patran, Femap, NX or other interactive tool. Normally, if you know and understand your model and and your script, you can decide what output your script should produce.

Regards,

Renaud

Olivier Miramand

unread,
Mar 5, 2026, 10:25:08 AM (5 days ago) Mar 5
to FeResPost
Hello Renaud,

Yes in fact, the missing values are append with custom script like this:

 for k, v in resultCopy.getData():
            elemId = k.getElemId()
            nodeId = k.getNodeId()
            layerId= k.getLayerId()
            subLayerId = k.getSubLayerId()
            nbrVals = v.getNbrVals()
            nbrExtraVals = v.getNbrExtraVals()
            csId = v.getCid()
            resultDesc = [elemId,
                    nodeId,
                    pyferespost.result.key.getLayer(layerId),
                    pyferespost.result.key.getSubLayer(subLayerId),
                    nbrVals,
                    pyferespost.result.values.cidType.getNameFromIntId(csId)]

            for i in range(0, nbrVals):
                resultDesc.append(v.getValsAt(i))
            for i in range(0, nbrExtraVals):
                resultDesc.append(v.getExtraValsAt(i))
            resultList.append(resultDesc)

But I don't understand what to do to replace the missing properties and method with your new version ?
(getElemId, getNodeId, getLayerId getSubLaye and getNbrExtra seems to be replaced)
Is it possible to indicate me the right approche please ?

Exemple with :
 db.getResultCopy( "LOADCASE1", "Statics", "Strain Tensor" "Elements", group, [])

How I can append the needed value in a list ?
(I not a user, I have to migrate the code only..)

Thank you
Bres regards,
Olivier

Renaud Sizaire

unread,
Mar 5, 2026, 12:12:09 PM (5 days ago) Mar 5
to fere...@googlegroups.com
Olivier,

FeResPost Result.getData() method returns an Array of Arrays as follows (extract of FeResPost User Manual) :
What I see in your script is something very different. Obviously you are using a getData method from a class in a different library that performs something similar to FeResPost Result.getData(). But it is another library and another function.

I think that FeResPost User Manual explains clearly FeResPost Result.getData() method. On the other hand, if you have difficulties understanding what your library does, you should check in its manual or ask the developer. I do not think I must try to understand your derived library.

Regards,

Renaud

Le 05-03-26 à 16:25, Olivier Miramand a écrit :
--
You received this message because you are subscribed to the Google Groups "FeResPost" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ferespost+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/ferespost/6966d698-3691-40ea-bd30-fbfe9f35c75bn%40googlegroups.com.


Olivier Miramand

unread,
Mar 9, 2026, 5:22:54 AM (yesterday) Mar 9
to FeResPost
Hello,
OK I understand that getData() return a two dimenssional array.
But when I try to loop I cannot get all informations what I need

Statics
STRAINS IN PENTAHEDRON ELEMENTS (PENTA)
ELEMENT ID NODE ID LOADCASE1
165 NORMAL-X 0.0001063057134160772
165 NORMAL-Y -0.00011038091906812042
165 NORMAL-Z 3.739769454114139e-05
165 SHEAR-XY ?
165 SHEAR-XY ?
165 SHEAR-XY ?
165 PRINCIPAL A ?
165 PRINCIPAL B ?
165 PRINCIPAL C ?
165 LX A ?
165 LX B ?
165 LX C ?
165 LY A ?
165 LY B ?
165 LY C ?
165 LZ A ?
165 LZ B ?
165 LZ C ?
165 PRESSURE ?
165 VON MISES ?

See the folowing of my sample line with getData() (none information about SHEAR-XY etc..)
is it possible to send me a loop to get missing data please ? 

[165, 'NONE', 'NONE', 0, 0, 0.00033261810312978923, -0.0005015808856114745, -1.1777596228057519e-05, -0.0013662211131304502, -0.0001691377692623064, -0.00019752485968638211], [165, 40, 'NONE', 0, 0, 0.00046641973312944174, -0.0008631807286292315, -4.854129656450823e-05, -0.0013732683146372437, -0.0003783148422371596, -0.00013239039981272072], [165, 41, 'NONE', 0, 0, 0.0006359170074574649, -0.0009223810629919171, -6.095288699725643e-05, -0.0014243084006011486, -0.00035110316821374, -0.00025561213260516524], [165, 51, 'NONE', 0, 0, 4.4843487557955086e-05, -8.078073733486235e-05, 2.4986105927382596e-05, -0.0013732683146372437, 2.7627700546872802e-05, -0.00013239039981272072], [165, 52, 'NONE', 0, 0, 0.00021434073278214782, -0.0001399811008013785, 1.2574515494634397e-05, -0.0014243084006011486, 5.483938002726063e-05, -0.00025561213260516524], [165, 125, 'NONE', 0, 0, 0.0005278819589875638, -0.0008927808958105743, -3.612970613176003e-05, -0.0013010866241529584, -0.00038690914516337216, -0.00020457203208934516], [165, 130, 'NONE', 0, 0, 0.0001063057134160772, -0.00011038091906812042, 3.739769454114139e-05, -0.0013010866241529584, 1.9033404896617867e-05, -0.00020457203208934516],  [166,....

Renaud Sizaire

unread,
Mar 9, 2026, 1:22:52 PM (yesterday) Mar 9
to fere...@googlegroups.com
Hello Olivier,

It is because FeResPost does not read the principal stresses, pressure, Von Mises... OPnly the components of Cauchy stress tensor are read. But the Result class has methods that allow to derive Von Mises or principal stresses from the Cauchy stress tensor Results. (See the "deriveTensorToOneScal" method in Results class, for example.)

Regards,

Renaud

Le 09-03-26 à 10:22, Olivier Miramand a écrit :

Olivier Miramand

unread,
6:51 AM (15 hours ago) 6:51 AM
to FeResPost
Okay, thank you very much.

But is it possible that the value has changed between the old library and the new one (regarding Von Mises)?
Because I'm afraid I'll get a difference (I'm not a user...).

Example:
with the old version, the result for ElementD 180 Node 149
180 149 VON MISES 0.00042230260442

But with the new library, I get:
...
db=NastranDb()
db.readBdf("Modele_complet_sol101_2cas_2012r2.dat")
db.readOp2("Modele_complet_sol101_2cas_2012r2.op2","Results")
test = db.getResultCopy("LOADCASE1","Statics","Strain Tensor","Elements")
print(test.deriveTensorToOneScal('VonMises').getData())
.....
[180, 149, 'NONE', 0, 'NONE', 0.0006334538920782506]

Thank you for the tips..

Olivier

fere...@gmail.com

unread,
1:22 PM (8 hours ago) 1:22 PM
to fere...@googlegroups.com
Olivier,

If you read the same components for stress tensor, I would be very surprised that FeResPost calculates a different Von Mises derivation than before.

Note that generally, Von Mises is calculated from Stress tensor, not from Strain.

Regards,

Renaud


Le 10-03-26 à 11:51, Olivier Miramand a écrit :
You received this message because you are subscribed to a topic in the Google Groups "FeResPost" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ferespost/PyR3y6wD4lo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ferespost+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/ferespost/e20d1300-be1c-40f3-a7bf-db681dfb276an%40googlegroups.com.


Reply all
Reply to author
Forward
0 new messages