[Finally DONE] conda: vtk9 / occt7.5 / python3.9 / boost1.74 migration

This subforum is specifically to discuss packaging issues on different platforms (windows, mac, linux), and using different packaging systems (conda, etc...)
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: [C++ EXPERT NEEDED!!!!] conda: vtk9 / occt7.5 / python3.9 / boost1.74 migration

Post by wmayer »

Here is another solution that uses two different std::vector for SMDS_MeshNode and SMDS_MeshCell.

You add

Code: Select all

#include "SMDS_MeshNode.hxx"
and replace:

Code: Select all

  SMDS_MeshElement*    myElements;    // array of elements

Code: Select all

  std::vector<SMDS_MeshNode> myNodeElements; // array of node elements
  std::vector<SMDS_MeshCell> myCellElements; // array of cell elements
and

Code: Select all

  SMDS_MeshElement* Element(int index) { return & myElements[index]; }

Code: Select all

  SMDS_MeshElement* Element(int index)
  {
    if (!myNodeElements.empty())
      return &myNodeElements[index];
    else
      return &myCellElements[index];
  }
and

Code: Select all

  const SMDS_MeshElement* Element(int index) const { return & myElements[index]; }

Code: Select all

  const SMDS_MeshElement* Element(int index) const
  {
    if (!myNodeElements.empty())
      return &myNodeElements[index];
    else
      return &myCellElements[index];
  }
and

Code: Select all

  int Index( const SMDS_MeshElement* e ) const { return (int)( e - myElements ); }

Code: Select all

  int Index( const SMDS_MeshElement* e ) const
  {
    if (!myNodeElements.empty())
      return (int)( static_cast<const SMDS_MeshNode*>(e) - myNodeElements.data() );
    else;
      return (int)( static_cast<const SMDS_MeshCell*>(e) - myCellElements.data() );
  }
and

Code: Select all

  if ( myFactory->myIsNodal )
    myElements = new SMDS_MeshNode[ theChunkSize ];
  else
    myElements = new SMDS_MeshCell[ theChunkSize ];

Code: Select all

  if ( myFactory->myIsNodal )
    myNodeElements.resize(theChunkSize);
  else
    myCellElements.resize(theChunkSize);
and remove

Code: Select all

delete [] myElements;
Btw, with git diff --submodule=diff I didn't get a result because the smesh source files are copied from external to src. So here you see the diff:
smesh_diff.txt
(3.64 KiB) Downloaded 80 times
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: [C++ EXPERT NEEDED!!!!] conda: vtk9 / occt7.5 / python3.9 / boost1.74 migration

Post by looo »

wmayer wrote: Tue Oct 05, 2021 3:45 pm Here is another solution that uses two different std::vector for SMDS_MeshNode and SMDS_MeshCell.
thanks @wmayer, now the test works on the mac. I will update the freecad-bundles to the new smesh versions (9.7.0) in the next days (hopefully the interface hasn't changed) then we will see if the problem was resolved.

https://github.com/trelau/SMESH/pull/53
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: [C++ EXPERT NEEDED!!!!] conda: vtk9 / occt7.5 / python3.9 / boost1.74 migration

Post by looo »

There is now a package for smesh 9.7 available. Compiling FreeCAD against this package fixes the smesh-crash for freecad. The bundles will be updated to smesh 9.7 next sunday.

Big thanks to @tom and @wmayer for solving this issue.
Post Reply