mirror of
https://github.com/NGSolve/netgen.git
synced 2024-11-14 10:08:32 +05:00
* Nglib: Added the capability to merge a VOL mesh file into an already existing mesh in memory
This commit is contained in:
parent
3e8f2ab440
commit
b20dda8e4a
@ -134,6 +134,56 @@ namespace nglib
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Merge another mesh file into the currently loaded one
|
||||||
|
DLL_HEADER Ng_Result Ng_MergeMesh( Ng_Mesh* mesh, const char* filename)
|
||||||
|
{
|
||||||
|
Ng_Result status = NG_OK;
|
||||||
|
|
||||||
|
ifstream infile(filename);
|
||||||
|
Mesh * m = (Mesh*)mesh;
|
||||||
|
|
||||||
|
if(!infile.good())
|
||||||
|
{
|
||||||
|
status = NG_FILE_NOT_FOUND;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!m)
|
||||||
|
{
|
||||||
|
status = NG_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(status == NG_OK)
|
||||||
|
{
|
||||||
|
const int num_pts = m->GetNP();
|
||||||
|
const int face_offset = m->GetNFD();
|
||||||
|
|
||||||
|
m->Merge(infile, face_offset);
|
||||||
|
|
||||||
|
if(m->GetNP() > num_pts)
|
||||||
|
{
|
||||||
|
status = NG_OK;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
status = NG_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Merge another mesh file into the currently loaded one
|
||||||
|
DLL_HEADER Ng_Result Ng_MergeMesh( Ng_Mesh* mesh1, Ng_Mesh* mesh2)
|
||||||
|
{
|
||||||
|
return NG_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Manually add a point to an existing mesh object
|
// Manually add a point to an existing mesh object
|
||||||
DLL_HEADER void Ng_AddPoint (Ng_Mesh * mesh, double * x)
|
DLL_HEADER void Ng_AddPoint (Ng_Mesh * mesh, double * x)
|
||||||
{
|
{
|
||||||
|
@ -254,6 +254,35 @@ DLL_HEADER void Ng_SaveMesh(Ng_Mesh * mesh, const char* filename);
|
|||||||
*/
|
*/
|
||||||
DLL_HEADER Ng_Mesh * Ng_LoadMesh(const char* filename);
|
DLL_HEADER Ng_Mesh * Ng_LoadMesh(const char* filename);
|
||||||
|
|
||||||
|
|
||||||
|
/*! \brief Merge a Netgen VOL Mesh from disk into an existing mesh in memory
|
||||||
|
|
||||||
|
A Netgen mesh saved in the internal VOL format can be merged
|
||||||
|
into an existing Netgen Mesh structure using this function.
|
||||||
|
|
||||||
|
\param mesh Name of the Mesh structure already existent in memory
|
||||||
|
\param filename Pointer to a character array containing the
|
||||||
|
name of the file to load
|
||||||
|
\return Ng_Result Status of the merge operation
|
||||||
|
*/
|
||||||
|
DLL_HEADER Ng_Result Ng_MergeMesh(Ng_Mesh * mesh, const char* filename);
|
||||||
|
|
||||||
|
|
||||||
|
/*! \brief Merge one Netgen Mesh into another Netgen Mesh in the case
|
||||||
|
when both are already in memory
|
||||||
|
|
||||||
|
(NOTE: FUNCTION STILL WORK IN PROGRESS!!!)
|
||||||
|
|
||||||
|
This function can be used to merge two Netgen meshes already present
|
||||||
|
in memory.
|
||||||
|
|
||||||
|
\param mesh1 Parent Mesh structure into which the second mesh
|
||||||
|
will be merged
|
||||||
|
\param mesh2 Child mesh structure which will get merged into
|
||||||
|
the parent mesh
|
||||||
|
\return Ng_Result Status of the merge operation
|
||||||
|
*/
|
||||||
|
DLL_HEADER Ng_Result Ng_MergeMesh(Ng_Mesh * mesh1, Ng_Mesh * mesh2);
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user