Esempio n. 1
0
int NGInterface::generateVolumeMesh(void)
{
    mesh->CalcLocalH(mparam.grading);

    MeshVolume (mparam, *mesh);
    RemoveIllegalElements (*mesh);
    OptimizeVolume (mparam, *mesh);
    return 1;
}
    bool make_mesh::run_impl()
    {
      output_parameter_proxy<netgen::mesh> omp(output_mesh);

      StdCaptureHandle capture_handle;

      if (omp != input_mesh)
        omp() = input_mesh();


      ::netgen::MeshingParameters mesh_parameters;

      if (cell_size.valid())
      {
        ::netgen::Point3d pmin;
        ::netgen::Point3d pmax;
        omp()().GetBox(pmin, pmax);

        double bb_volume = std::abs( (pmax.X() - pmin.X()) * (pmax.Y() - pmin.Y()) * (pmax.Z() - pmin.Z()) );
        double cell_volume = cell_size()*cell_size()*cell_size();
        double max_cell_count = 100000000;

        if ( cell_volume * max_cell_count < bb_volume )
        {
          warning(1) << "Cell size is too small and might result in too much elements" << std::endl;
          warning(1) << "Cell size                = " << cell_size() << std::endl;
          warning(1) << "Mesh max cell count      = " << max_cell_count << std::endl;
          warning(1) << "Mesh bounding box        = " << pmin << "," << pmax << std::endl;
          warning(1) << "Mesh bounding box volume = " << bb_volume << std::endl;
          warning(1) << "Mesh max cell volume     = " << cell_volume * max_cell_count << std::endl;
        }

        mesh_parameters.maxh = cell_size();
      }

      try
      {
        omp()().CalcLocalH(mesh_parameters.grading);
        MeshVolume (mesh_parameters, omp()());
        RemoveIllegalElements (omp()());
        OptimizeVolume (mesh_parameters, omp()());
      }
      catch (::netgen::NgException const & ex)
      {
        error(1) << "Netgen Error: " << ex.What() << std::endl;
        return false;
      }

      return true;
    }
Esempio n. 3
0
// generates volume mesh from surface mesh
DLL_HEADER Ng_Result Ng_GenerateVolumeMesh (Ng_Mesh * mesh, Ng_Meshing_Parameters * mp)
{
  Mesh * m = (Mesh*)mesh;
  
  
  MeshingParameters mparam;
  mparam.maxh = mp->maxh;
  mparam.meshsizefilename = mp->meshsize_filename;

  m->CalcLocalH();

  MeshVolume (mparam, *m);
  RemoveIllegalElements (*m);
  OptimizeVolume (mparam, *m);

  return NG_OK;
}
Esempio n. 4
0
   // Generates volume mesh from an existing surface mesh
   DLL_HEADER Ng_Result Ng_GenerateVolumeMesh (Ng_Mesh * mesh, Ng_Meshing_Parameters * mp)
   {
      Mesh * m = (Mesh*)mesh;

      // Philippose - 30/08/2009
      // Do not locally re-define "mparam" here... "mparam" is a global 
      // object 
      //MeshingParameters mparam;
      mp->Transfer_Parameters();

      m->CalcLocalH();

      MeshVolume (mparam, *m);
      RemoveIllegalElements (*m);
      OptimizeVolume (mparam, *m);

      return NG_OK;
   }
Esempio n. 5
0
   // Generates volume mesh from an existing surface mesh
   DLL_HEADER Ng_Result Ng_GenerateVolumeMesh (Ng_Mesh * mesh, Ng_Meshing_Parameters * mp)
   {
      Mesh * m = (Mesh*)mesh;

      // Philippose - 30/08/2009
      // Do not locally re-define "mparam" here... "mparam" is a global 
      // object 
      //MeshingParameters mparam;
      mparam.maxh = mp->maxh;
      mparam.meshsizefilename = mp->meshsize_filename;

      double fineness = min(1., max(0., mp->fineness));
      mparam.curvaturesafety = 0.3 + 5 * fineness;
      mparam.segmentsperedge = 0.3 + 5 * fineness;

      m->CalcLocalH();

      MeshVolume (mparam, *m);
      RemoveIllegalElements (*m);
      OptimizeVolume (mparam, *m);

      return NG_OK;
   }
Esempio n. 6
0
  int NetgenGeometry :: GenerateMesh (shared_ptr<Mesh> & mesh, MeshingParameters & mparam,
				      int perfstepsstart, int perfstepsend)
  {
    if (!mesh) return 1;

    if (perfstepsstart <= MESHCONST_MESHVOLUME)
      {
	multithread.task = "Volume meshing";
	
	MESHING3_RESULT res =
	  MeshVolume (mparam, *mesh);
	
	if (res != MESHING3_OK) return 1;
	
	if (multithread.terminate) return 0;
	
	RemoveIllegalElements (*mesh);
	if (multithread.terminate) return 0;

	MeshQuality3d (*mesh);
      }

    
    if (multithread.terminate || perfstepsend <= MESHCONST_MESHVOLUME)
      return 0;


    if (perfstepsstart <= MESHCONST_OPTVOLUME)
      {
	multithread.task = "Volume optimization";
	
	OptimizeVolume (mparam, *mesh);
	if (multithread.terminate) return 0;
      }
    
    return 0;
  }