[Gmsh] Fwd: Max number of fields

Max Orok morok at mevex.com
Fri Oct 26 18:01:32 CEST 2018


Hello Alessandro,

I tried to add fields to an empty model using the attached program.
I think your main problem would be with the time needed to insert in a map.

Here are some rough timings from adding the "Box" size field.

1    min   -      50,000
4    min   -      90,000
5    min   -    100,000
6.5 min   -    110,000
12 min    -    150,000

For really large numbers (millions, etc.), you might need preallocation
instead of adding one-by-one.
I don't think this is possible with the current SDK.
The SDK C++ header's add function "only" has an int return value, so around
4 billion is nominally the front-end limit.

If the header was ever modified, I think the background meshes are tracked
with a pointer map (from BackgroundMeshManager.h):

static std::map<GEntity *, BGMBase *> data;

Using the max_size map method I got around 3.8e17.
The real number is probably much lower than that because of allocation
problems etc.

Sincerely,
Max

On Fri, Oct 26, 2018 at 6:01 AM, Alessandro Vicini <
alessandro.vicini at sitael.com> wrote:

>
>
> Hello Gmsh users, is there some limitation whatsoever to the number of
> fields that can be defined for mesh size control? I think I might need a
> “huge” number of fields for some automatic adaptive grid refinement…
>
>
>
> A.
>
>
>
>
>
> _______________________________________________
> gmsh mailing list
> gmsh at onelab.info
> http://onelab.info/mailman/listinfo/gmsh
>
>


-- 
Max Orok
Contractor
www.mevex.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://onelab.info/pipermail/gmsh/attachments/20181026/26564a54/attachment.html>
-------------- next part --------------
#include "gmsh.h"
#include <iostream>

int main() {
  gmsh::initialize();
  int i {0};
  std::string fieldType {"Box"};

  try {
    while(true) {
      gmsh::model::mesh::field::add(fieldType);
      if (!(i % 10000)) {
        std::cout << i << std::endl;
      }
      i++;
    }
  }
  catch(...){
    std::cout << "exception thrown" << std::endl;
  }

  std::cout << "max number of " << fieldType << " fields is " << i << std::endl;
  gmsh::finalize();
}


More information about the gmsh mailing list