Any idea where exactly in the unv export it's needed to make the enum of the size of an unsigned long? And why doesn't the original Salome source code doesn't do it this way?vejmarie wrote:Is this on 32 bits or 64 bits Windows that the issue appears ? That is strange it did work on MacOS and Linux . This reminds me why I am not using Windows (I am kidding guys don't worry)
mesh distortion on reload (only quadratic elements)
Moderator: bernd
Forum rules
and Helpful information for the FEM forum
and Helpful information for the FEM forum
Re: mesh distortion on reload (only quadratic elements)
Re: mesh distortion on reload (only quadratic elements)
I undid the changes for the sizes of the enums in git commit 732bd85 and for me I still got the problems. I used Bernd's project file for import/export. Only after setting the size to unsigned long long (i.e. a size of 8 bytes) it worked on Windows, too.sgrogan wrote:Probably git commit 732bd85 shows the problem. The previous git commit 19f8fd4 does not.
MSVC has defined the type __int64 for 8 byte int's. You find a typedef in FCConfig.h that sets int64_t and uint64_t.sgrogan wrote:I can't find "long long" in the FreeCAD sources though. With C++11 "long long" is OK?
So, this means that the size of the enum must be equal to the word size in FreeCAD. So, instead of using unsigned long as we do now we have to switch to size_t because this is a typedef to the required type.UR_ wrote:win 32 bit build is ok.
As test you can use this test application:
Code: Select all
#include <stdio.h>
int main(int argc, char**)
{
printf("sizeof(size_t) = %d", sizeof(size_t));
}
Re: mesh distortion on reload (only quadratic elements)
I have pushed a branch which works fine on Win64 and Ubuntu 14.04 64-bit. Please test also on other platforms.
Does anyone know how to create a 2nd order mesh using the Python API so that we could also write a unit test?
Does anyone know how to create a 2nd order mesh using the Python API so that we could also write a unit test?
- vejmarie
- Posts: 713
- Joined: Mon Jan 04, 2016 4:52 pm
- Location: Somewhere between France, USA and Taiwan
- Contact:
Re: mesh distortion on reload (only quadratic elements)
Salome is not supported on MacOS or Windows, or not tested as much as on Linux, which could explain why they didn't faced this issue.wmayer wrote:Any idea where exactly in the unv export it's needed to make the enum of the size of an unsigned long? And why doesn't the original Salome source code doesn't do it this way?vejmarie wrote:Is this on 32 bits or 64 bits Windows that the issue appears ? That is strange it did work on MacOS and Linux . This reminds me why I am not using Windows (I am kidding guys don't worry)
Re: mesh distortion on reload (only quadratic elements)
wmayer wrote:I have pushed a branch which works fine on Win64 and Ubuntu 14.04 64-bit. Please test also on other platforms.
wmayer wrote:Does anyone know how to create a 2nd order mesh using the Python API so that we could also write a unit test?
Code: Select all
# 10 node tetrahedron --> tetra10 ###############
import Fem
tetra10 = Fem.FemMesh()
tetra10.addNode( 6, 12, 18, 1)
tetra10.addNode( 0, 0, 18, 2)
tetra10.addNode(12, 0, 18, 3)
tetra10.addNode( 6, 6, 0, 4)
tetra10.addNode( 3, 6, 18, 5)
tetra10.addNode( 6, 0, 18, 6)
tetra10.addNode( 9, 6, 18, 7)
tetra10.addNode( 6, 9, 9, 8)
tetra10.addNode( 3, 3, 9, 9)
tetra10.addNode( 9, 3, 9,10)
tetra10.addVolume([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
tetra10
# make a document object, possible, but not needed
obj = App.ActiveDocument.addObject("Fem::FemMeshObject","tetra10")
obj.FemMesh = tetra10
obj.ViewObject.DisplayMode = "Faces, Wireframe & Nodes"
# write and read the mesh
mymeshfile = '/tmp/hallo.unv'
tetra10.write(mymeshfile)
newmesh = Fem.read(mymeshfile)
newmesh
# make a document object, possible, but not needed
obj = App.ActiveDocument.addObject("Fem::FemMeshObject","newtetra10")
obj.FemMesh = newmesh
obj.ViewObject.DisplayMode = "Faces, Wireframe & Nodes"
obj.Placement.Base = (0,30,0)
Re: mesh distortion on reload (only quadratic elements)
Salome users can lay back.vejmarie wrote:
Salome is not supported on MacOS or Windows, or not tested as much as on Linux, which could explain why they didn't faced this issue.
Everything's alright.
saved and reloaded on Salome 8.2.0 Win64
Re: mesh distortion on reload (only quadratic elements)
Thanks for looking. I had seen this as well, but didn't know which would be preferred. I see you've chosen size_t. Out of curiousity what is the difference from uint64_t?wmayer wrote:MSVC has defined the type __int64 for 8 byte int's. You find a typedef in FCConfig.h that sets int64_t and uint64_t.
"fight the good fight"
Re: mesh distortion on reload (only quadratic elements)
I have extended the above example:sgrogan wrote:Thanks for looking. I had seen this as well, but didn't know which would be preferred. I see you've chosen size_t. Out of curiousity what is the difference from uint64_t?wmayer wrote:MSVC has defined the type __int64 for 8 byte int's. You find a typedef in FCConfig.h that sets int64_t and uint64_t.
Code: Select all
#include <stdio.h>
#include <stdint.h>
int main(int argc, char**)
{
printf("sizeof(size_t) = %d\n", sizeof(size_t));
printf("sizeof(uint64_t) = %d\n", sizeof(uint64_t));
}
But this means that Salome must has solved this issue differently as in their code they don't set the enum sizes.UR_ wrote:Salome users can lay back.
Everything's alright.
saved and reloaded on Salome 8.2.0 Win64
Re: mesh distortion on reload (only quadratic elements)
Thank you very much.bernd wrote:wmayer wrote:Does anyone know how to create a 2nd order mesh using the Python API so that we could also write a unit test?Code: Select all
# 10 node tetrahedron --> tetra10 ############### import Fem tetra10 = Fem.FemMesh() tetra10.addNode( 6, 12, 18, 1) tetra10.addNode( 0, 0, 18, 2) tetra10.addNode(12, 0, 18, 3) tetra10.addNode( 6, 6, 0, 4) tetra10.addNode( 3, 6, 18, 5) tetra10.addNode( 6, 0, 18, 6) tetra10.addNode( 9, 6, 18, 7) tetra10.addNode( 6, 9, 9, 8) tetra10.addNode( 3, 3, 9, 9) tetra10.addNode( 9, 3, 9,10) tetra10.addVolume([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) tetra10 # make a document object, possible, but not needed obj = App.ActiveDocument.addObject("Fem::FemMeshObject","tetra10") obj.FemMesh = tetra10 obj.ViewObject.DisplayMode = "Faces, Wireframe & Nodes" # write and read the mesh mymeshfile = '/tmp/hallo.unv' tetra10.write(mymeshfile) newmesh = Fem.read(mymeshfile) newmesh # make a document object, possible, but not needed obj = App.ActiveDocument.addObject("Fem::FemMeshObject","newtetra10") obj.FemMesh = newmesh obj.ViewObject.DisplayMode = "Faces, Wireframe & Nodes" obj.Placement.Base = (0,30,0)
Re: mesh distortion on reload (only quadratic elements)
might be helpful too ...wmayer wrote:Thank you very much.bernd wrote:wmayer wrote:Does anyone know how to create a 2nd order mesh using the Python API so that we could also write a unit test?Code: Select all
...
Code: Select all
tetra10.Volume
newmesh.Volume
Code: Select all
>>>
>>> tetra10.Volume
432 mm^3
>>> newmesh.Volume
432 mm^3
>>>