using System; using System.Runtime.InteropServices; using System.Text; namespace Deltares.IONetCDF.Managed { public sealed partial class Wrapper { /// /// Checks whether the specified data set adheres to a specific set of conventions. /// Data sets may adhere to multiple conventions at the same time, so use this method /// to check for individual conventions. /// /// TODO /// The NetCDF conventions type to check for. /// Whether or not the file adheres to the specified conventions. [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_adheresto_conventions", CallingConvention = CallingConvention.Cdecl)] private static extern bool ionc_adheresto_conventions_dll(ref int ioncid, ref int iconvtype); /// /// Inquire the NetCDF conventions used in the data set. /// /// The IONetCDF data set id. /// The NetCDF conventions type of the data set. /// TODO /// Result status (IONC_NOERR if successful). [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_inq_conventions", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_inq_conventions_dll(ref int ioncid, ref int iconvtype, ref double convversion); /// /// Tries to open a NetCDF file and initialize based on its specified conventions. /// /// File name for NetCDF data set to be opened. /// NetCDF open mode, e.g. NF90_NOWRITE. /// The IONetCDF data set id (this is not the NetCDF ncid, which is stored in datasets(ioncid)%ncid). /// The detected conventions in the file. /// TODO /// Result status (IONC_NOERR if successful). [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_open", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_open_dll([In] string c_path, [In, Out] ref int mode, [In, Out] ref int ioncid, [In, Out] ref int iconvtype, ref double convversion); /// /// Tries to close an open IONetCDF data set. /// /// The IONetCDF data set id (this is not the NetCDF ncid, which is stored in datasets(ioncid)%ncid). /// Result status (IONC_NOERR if successful). [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_close", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_close_dll([In] ref int ioncid); [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_get_1d_network_name", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_1d_get_network_name_dll([In] ref int ncidin, [In] ref int networkId, [MarshalAs(UnmanagedType.LPStr)] [In, Out] StringBuilder networkName); #region UGRID specifics [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_def_var", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_def_var_dll(ref int ioncid, ref int meshId, ref int networkId, ref int varId, ref int type, ref int locType, string varName, string standardName, string longName, string unit, ref int fillValueInt, ref double fillValue); /// /// Get the id of the geometry network. /// /// The IONetCDF data set id (in). /// The network id (out). /// TODO [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_get_1d_network_id", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_get_1d_network_id_dll([In] ref int ioncid, [In, Out] ref int networkid); /// /// Get the id of the 1D mesh. /// /// The IONetCDF data set id. /// The mesh id in the specified data set (out). /// TODO [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_get_1d_mesh_id", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_get_1d_mesh_id_dll([In] ref int ioncid, [In, Out] ref int meshId); /// /// Get the id of the 2d mesh. /// /// The IONetCDF data set id. /// The mesh id in the specified data set (out). /// TODO [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_get_2d_mesh_id", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_get_2d_mesh_id_dll([In] ref int ioncid, [In, Out] ref int meshId); /// /// Get the id of the 3d mesh. /// /// The IONetCDF data set id. /// The mesh id in the specified data set (out). /// TODO [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_get_3d_mesh_id", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_get_3d_mesh_id_dll([In] ref int ioncid, [In, Out] ref int meshId); /// /// Gets the number of mesh from a data set. /// /// The IONetCDF data set id. /// Number of meshes. /// Result status (IONC_NOERR if successful). [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_get_mesh_count", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_get_mesh_count_dll([In, Out] ref int ioncid, [In, Out] ref int nmesh); /// /// Gets the name of mesh from a data set. /// /// The IONetCDF data set id. /// The mesh id in the specified data set. /// The mesh name. /// Result status (IONC_NOERR if successful). [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_get_mesh_name", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_get_mesh_name_dll([In, Out] ref int ioncid, [In, Out] ref int meshId, [MarshalAs(UnmanagedType.LPStr)] [In, Out] StringBuilder meshName); /// /// Gets the number of nodes in a single mesh from a data set. /// /// The IONetCDF data set id. /// The mesh id in the specified data set. /// Number of nodes. /// Result status (IONC_NOERR if successful). [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_get_node_count", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_get_node_count_dll(ref int ioncid, ref int meshId, ref int nnode); /// /// Gets the number of edges in a single mesh from a data set. /// /// The IONetCDF data set id. /// The mesh id in the specified data set. /// Number of edges. /// Result status (IONC_NOERR if successful). [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_get_edge_count", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_get_edge_count_dll(ref int ioncid, ref int meshId, ref int nedge); /// /// Gets the number of faces in a single mesh from a data set. /// /// The IONetCDF data set id. /// The mesh id in the specified data set. /// Number of faces. /// Result status (IONC_NOERR if successful). [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_get_face_count", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_get_face_count_dll(ref int ioncid, ref int meshId, ref int nface); /// /// Gets the maximum number of nodes for any face in a single mesh from a data set. /// /// The IONetCDF data set id. /// The mesh id in the specified data set. /// The maximum number of nodes per face in the mesh.Number of faces. /// Result status (IONC_NOERR if successful). [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_get_max_face_nodes", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_get_max_face_nodes_dll(ref int ioncid, ref int meshId, ref int nmaxfacenodes); /// /// Gets the x,y coordinates for all nodes in a single mesh from a data set. /// /// The IONetCDF data set id. /// The mesh id in the specified data set. /// Pointer to array for x-coordinates. /// Pointer to array for y-coordinates. /// The number of nodes in the mesh. /// Result status (IONC_NOERR if successful). [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_get_node_coordinates", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_get_node_coordinates_dll([In, Out] ref int ioncid, [In, Out] ref int meshId, [In, Out] ref IntPtr c_xptr, [In, Out] ref IntPtr c_yptr, [In, Out] ref int nnode); /// /// Gets the edge-node connectivity table for all edges in the specified mesh. /// The output edge_nodes array is supposed to be of exact correct size already. /// /// The IONetCDF data set id. /// The mesh id in the specified data set. /// Pointer to array for the edge-node connectivity table. /// The number of edges in the mesh. /// TODO /// Result status (IONC_NOERR if successful). [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_get_edge_nodes", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_get_edge_nodes_dll(ref int ioncid, ref int meshId, ref IntPtr c_edge_nodes_ptr, ref int nedge, ref int startIndex); /// /// Gets the face-node connectivity table for all faces in the specified mesh. /// The output face_nodes array is supposed to be of exact correct size already. /// /// The IONetCDF data set id. /// The mesh id in the specified data set. /// Pointer to array for the face-node connectivity table. /// The number of faces in the mesh. /// The maximum number of nodes per face in the mesh. /// Double precision fill value (in). /// TODO /// Result status (IONC_NOERR if successful). [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_get_face_nodes", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_get_face_nodes_dll(ref int ioncid, ref int meshId, ref IntPtr c_face_nodes_ptr, ref int nface, ref int nmaxfacenodes, ref int fillvalue, ref int startIndex); [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_write_geom_ugrid", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_write_geom_ugrid_dll(string filename); [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_write_map_ugrid", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_write_map_ugrid_dll(string filename); [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_get_coordinate_system", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_get_coordinate_system_dll([In] ref int ioncid, [In, Out] ref int nmesh); [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_get_var_count", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_get_var_count_dll([In] ref int ioncid, [In] ref int mesh, [In] ref int location, [In, Out] ref int nCount); [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_inq_varid", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_inq_varid_dll(ref int ioncid, ref int meshId, string varName, ref int varId); [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_inq_varid_by_standard_name", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_inq_varid_by_standard_name_dll(ref int ioncid, ref int meshId, ref int location, string standardName, ref int varId); [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_inq_varids", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_inq_varids_dll(ref int ioncid, ref int meshId, ref int location, ref IntPtr ptr, ref int nVar); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] public delegate void IO_NetCDF_Message_Callback(int level, [MarshalAs(UnmanagedType.LPStr)] string message); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] public delegate void IO_NetCDF_Progress_Callback([MarshalAs(UnmanagedType.LPStr)] string message, ref double progress); [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_initialize", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_initialize_dll(IO_NetCDF_Message_Callback c_message_callback, IO_NetCDF_Progress_Callback c_progress_callback); [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_get_var", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_get_var_dll(ref int ioncid, ref int meshId, ref int location, string varname, ref IntPtr c_zptr, ref int nNode, ref double c_fillvalue); [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_put_var", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_put_var_dll(ref int ioncid, ref int meshId, ref int iloctype, string c_varname, ref IntPtr c_values_ptr, ref int nVal); [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_put_node_coordinates", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_put_node_coordinates_dll(ref int ioncid, ref int meshId, ref IntPtr c_xvalues_ptr, ref IntPtr c_yvalues_ptr, ref int nNode); #endregion #region 1d2d Links /// /// Gets the 1d2d grid. /// /// TODO /// The mesh id in the specified data set. /// TODO /// TODO /// TODO /// TODO [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_get_meshgeom", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_get_meshgeom_dll(ref int ioncid, ref int meshid, ref int networkId, [In, Out] ref meshgeom meshgeom, ref int startIndex, ref bool includeArrays); /// /// Gets the dimension of the 1d2d grid. /// /// TODO /// The mesh id in the specified data set. /// TODO /// TODO [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_get_meshgeom_dim", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_get_meshgeom_dim_dll([In] ref int ioncid, [In] ref int meshid, [In] ref int networkId, [In, Out] ref meshgeomdim meshgeomdim); [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_put_meshgeom", CallingConvention = CallingConvention.Cdecl)] public static extern int ionc_put_meshgeom_dll([In] ref int ioncid, [In, Out] ref int meshid, [In, Out] ref int networkid, [In] ref meshgeom meshgeom, [In] ref meshgeomdim meshgeomdim, [In] string c_meshname, [In] string c_networkName, [In] ref int start_index); [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_write_mesh_1d_edge_nodes", CallingConvention = CallingConvention.Cdecl)] public static extern int ionc_write_mesh_1d_edge_nodes_dll([In] ref int ioncid, [In, Out] ref int meshid, [In, Out] ref int numEdge, [In] ref IntPtr c_mesh_1d_edge_nodes, [In] ref int start_index); [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_put_1d_mesh_edges", CallingConvention = CallingConvention.Cdecl)] public static extern int ionc_put_1d_mesh_edges_dll([In] ref int ioncid, [In, Out] ref int meshid, [In] ref IntPtr c_edgebranchidx, [In] ref IntPtr c_edgeoffset, [In, Out] ref int numEdge, [In] ref int start_index, [In] ref IntPtr c_coordx, [In] ref IntPtr c_coordy); #region meshgeom [StructLayout(LayoutKind.Sequential)] public struct meshgeom { public IntPtr edge_nodes; public IntPtr face_nodes; public IntPtr edge_faces; public IntPtr face_edges; public IntPtr face_links; public IntPtr nnodex; public IntPtr nnodey; public IntPtr nedge_nodes; public IntPtr nbranchlengths; public IntPtr nbranchgeometrynodes; public IntPtr ngeopointx; public IntPtr ngeopointy; public IntPtr nbranchorder; public IntPtr branchidx; public IntPtr branchoffsets; public IntPtr nodex; public IntPtr nodey; public IntPtr nodez; public IntPtr edgex; public IntPtr edgey; public IntPtr edgez; public IntPtr facex; public IntPtr facey; public IntPtr facez; public IntPtr layer_zs; public IntPtr interface_zs; } [StructLayout(LayoutKind.Sequential)] public struct meshgeomdim { //[MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] public char[] meshname; public int dim; public int numnode; public int numedge; public int numface; public int maxnumfacenodes; public int numlayer; public int layertype; public int nnodes; public int nbranches; public int ngeometry; public int epgs; } #endregion meshgeom #endregion #region UGRID 1D Specifics public const int idssize = 40; public const int longnamessize = 80; public const int metadatasize = 100; [StructLayout(LayoutKind.Sequential)] public struct interop_metadata { [MarshalAs(UnmanagedType.ByValArray, SizeConst = metadatasize)] public char[] institution; [MarshalAs(UnmanagedType.ByValArray, SizeConst = metadatasize)] public char[] source; [MarshalAs(UnmanagedType.ByValArray, SizeConst = metadatasize)] public char[] references; [MarshalAs(UnmanagedType.ByValArray, SizeConst = metadatasize)] public char[] version; [MarshalAs(UnmanagedType.ByValArray, SizeConst = metadatasize)] public char[] modelname; } /// /// TODO /// /// TODO /// TODO /// TODO [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_add_global_attributes", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_add_global_attributes_dll([In] ref int ioncid, ref interop_metadata metadata); /// /// This function creates a new NetCDF file. /// /// The path where the file will be created (in). /// The NetCDF opening mode (in). /// The NetCDF file id (out). /// TODO [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_create", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_create_dll([In] string c_path, [In] ref int mode, [In, Out] ref int ioncid); /// /// Create a 1D network in an opened NetCDF file. /// /// The NetCDF file id (in). /// The network id (out). /// The network name (in). /// The number of network nodes (in). /// The number of network branches (in). /// The number of geometry points (in). /// TODO [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_create_1d_network", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_create_1d_network_dll([In] ref int ioncid, [In, Out] ref int networkid, [In] string networkName, [In] ref int nNodes, [In] ref int nBranches, [In] ref int nGeometry); /// /// Write the coordinates of the network nodes. /// /// The NetCDF file id (in). /// The network id (in). /// The x coordinates of the network nodes (in). /// The y coordinates of the network nodes (in). /// The network node ids (in). /// The network node name (in). /// The number of network nodes (in). /// TODO [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_write_1d_network_nodes", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_write_1d_network_nodes_dll([In] ref int ioncid, [In] ref int networkid, [In] ref IntPtr c_nodesX, [In] ref IntPtr c_nodesY, [In] ref IntPtr ids, [In] ref IntPtr longNames, [In] ref int nNodes); /// /// Write the coordinates of the network nodes. /// /// The NetCDF file id (in). /// The network id (in). /// The x coordinates of the network nodes (in). /// The y coordinates of the network nodes (in). /// The network node ids (in). /// The network node name (in). /// The number of network nodes (in). /// TODO [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_write_1d_network_nodes_v1", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_write_1d_network_nodes_v1_dll([In] ref int ioncid, [In] ref int networkid, [In] ref IntPtr c_nodesX, [In] ref IntPtr c_nodesY, [In] ref IntPtr ids, [In] ref IntPtr longNames, [In] ref int nNodes); /// /// Write the coordinates of the network branches. /// /// The NetCDF file id (in). /// The network id (in). /// The source node id (in). /// The target node id (in). /// The network branch ids (in). /// The network branch name (in). /// The branch lengths (in). /// The number of geometry points in each branch (in). /// The number of branches (in). /// TODO /// TODO [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_put_1d_network_branches", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_put_1d_network_branches_dll([In] ref int ioncid, [In] ref int networkid, [In] ref IntPtr c_sourcenodeid, [In] ref IntPtr c_targetnodeid, [In] ref IntPtr ids, [In] ref IntPtr longNames, [In] ref IntPtr c_branchlengths, [In] ref IntPtr c_nbranchgeometrypoints, [In] ref int nBranches, [In] ref int startIndex); /// /// Write the coordinates of the network branches. /// /// The NetCDF file id (in). /// The network id (in). /// The source node id (in). /// The target node id (in). /// The network branch ids (in). /// The network branch name (in). /// The branch lengths (in). /// The number of geometry points in each branch (in). /// The number of branches (in). /// TODO /// TODO [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_put_1d_network_branches_v1", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_put_1d_network_branches_v1_dll([In] ref int ioncid, [In] ref int networkid, [In] ref IntPtr c_sourcenodeid, [In] ref IntPtr c_targetnodeid, [In] ref IntPtr ids, [In] ref IntPtr longNames, [In] ref IntPtr c_branchlengths, [In] ref IntPtr c_nbranchgeometrypoints, [In] ref int nBranches, [In] ref int startIndex); /// /// Writes the branch geometry (the geometry points). /// /// The NetCDF file id (in). /// The network id (in). /// The x coordinates of the geometry points (in). /// The y coordinates of the geometry points (in). /// The number of geometry points (in). /// TODO [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_write_1d_network_branches_geometry", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_write_1d_network_branches_geometry_dll([In] ref int ioncid, [In] ref int networkid, [In] ref IntPtr c_geopointsX, [In] ref IntPtr c_geopointsY, [In] ref int nGeometry); /// /// Writes a 1D mesh. The geometrical features (e.g. the branches and geometry points) are described in the network above. /// /// The NetCDF file id (in). /// The network name. /// The mesh id in the specified data set (out). /// The mesh name (in). /// The number of mesh points (in). /// TODO [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_create_1d_mesh", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_create_1d_mesh_dll([In] ref int ioncid, [In] string networkname, [In, Out] ref int meshId, [In] string meshname, [In] ref int nmeshpoints); /// /// Writes a 1D mesh. The geometrical features (e.g. the branches and geometry points) are described in the network above. /// /// The NetCDF file id (in). /// The network name. /// The mesh id in the specified data set (out). /// The mesh name (in). /// The number of mesh points (in). /// The number of edges (in). /// TODO /// TODO [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_create_1d_mesh_v1", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_create_1d_mesh_v1_dll([In] ref int ioncid, [In] string networkname, [In, Out] ref int meshId, [In] string meshname, [In] ref int nmeshpoints, [In] ref int nmeshedges, [In, Out] ref int writexy); /// /// Writes the mesh coordinates points. /// /// The NetCDF file id (in). /// The mesh id in the specified data set. /// The branch id for each mesh point (in). /// The offset along the branch from the starting point (in). /// The mesh node ids (in). /// The mesh node names (in). /// The number of mesh points (in). /// array start index. /// TODO [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_put_1d_mesh_discretisation_points", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_put_1d_mesh_discretisation_points_dll([In] ref int ioncid, [In] ref int meshid, [In] ref IntPtr c_branchidx, [In] ref IntPtr c_offset, [In] ref IntPtr ids, [In] ref IntPtr longNames, [In] ref int nmeshpoints, [In] ref int startIndex); /// /// Writes the mesh coordinates points. /// /// The NetCDF file id (in). /// The mesh id in the specified data set. /// The branch id for each mesh point (in). /// The offset along the branch from the starting point (in). /// The mesh node ids (in). /// The mesh node names (in). /// The number of mesh points (in). /// Array start index. /// TODO /// TODO /// TODO [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_put_1d_mesh_discretisation_points_v1", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_put_1d_mesh_discretisation_points_v1_dll([In] ref int ioncid, [In] ref int meshid, [In] ref IntPtr c_branchidx, [In] ref IntPtr c_offset, [In] ref IntPtr ids, [In] ref IntPtr longNames, [In] ref int nmeshpoints, [In] ref int startIndex, [In] ref IntPtr c_coordx, [In] ref IntPtr c_coordy); /// /// Writes the mesh coordinates points. /// /// The NetCDF file id (in). /// The mesh id in the specified data set. /// The branch id for each mesh point (in). /// The offset along the branch from the starting point (in). /// The mesh node ids (in). /// The mesh node names (in). /// The number of mesh points (in). /// Array start index. /// TODO /// TODO /// TODO [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_put_1d_mesh_discretisation_points_v2", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_put_1d_mesh_discretisation_points_v2_dll([In] ref int ioncid, [In] ref int meshid, [In] ref IntPtr c_branchidx, [In] ref IntPtr c_offset, [In] ref IntPtr ids, [In] ref IntPtr longNames, [In] ref int nmeshpoints, [In] ref int startIndex, [In] ref IntPtr c_coordx, [In] ref IntPtr c_coordy); /// /// Writes the mesh edges. /// /// The NetCDF file id (in). /// The mesh id in the specified data set. /// The branch id for each mesh edge (in). /// The offset along the branch from the starting point of the edge (in). /// The number of mesh points (in). /// Array start index. /// TODO [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_put_1d_mesh_edges", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_put_1d_mesh_edges_dll([In] ref int ioncid, [In] ref int meshid, [In] ref IntPtr c_edgebranchidx, [In] ref IntPtr c_edgeoffset, [In] ref int nmeshedges, [In] ref int startIndex); /// /// Get the number of network nodes. /// /// The NetCDF file id (in). /// The network id (in). /// The number of nodes(out). /// TODO [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_get_1d_network_nodes_count", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_get_1d_network_nodes_count_dll([In] ref int ioncid, [In] ref int networkid, [In, Out] ref int nNodes); /// /// Get the number of branches. /// /// The NetCDF file id (in). /// The network id (in). /// The number of branches (out). /// TODO [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_get_1d_network_branches_count", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_get_1d_network_branches_count_dll([In] ref int ioncid, [In] ref int networkid, [In, Out] ref int nBranches); /// /// Get the number of geometry points for all branches. /// /// The NetCDF file id (in). /// The network id (in). /// The number of geometry points for all branches (out). /// TODO [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_get_1d_network_branches_geometry_coordinate_count", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_get_1d_network_branches_geometry_coordinate_count_dll([In] ref int ioncid, [In] ref int networkid, [In, Out] ref int ngeometrypoints); /// /// Read the node coordinates and the charinfo. /// /// The NetCDF file id. /// The network id (in). /// The x coordinates of the network nodes (out). /// The y coordinates of the network nodes (out). /// The node ids (in). /// The node names (in). /// The number of network nodes (in). /// TODO [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_read_1d_network_nodes", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_read_1d_network_nodes_dll([In] ref int ioncid, [In] ref int networkid, [In, Out] ref IntPtr c_nodesX, [In, Out] ref IntPtr c_nodesY, [In] ref IntPtr ids, [In] ref IntPtr longNames, [In] ref int nNodes); /// /// Read the node coordinates and the charinfo. /// /// The NetCDF file id. /// The network id (in). /// The x coordinates of the network nodes (out). /// The y coordinates of the network nodes (out). /// The node ids (in). /// The node names (in). /// The number of network nodes (in). /// TODO [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_read_1d_network_nodes_v1", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_read_1d_network_nodes_v1_dll([In] ref int ioncid, [In] ref int networkid, [In, Out] ref IntPtr c_nodesX, [In, Out] ref IntPtr c_nodesY, [In] ref IntPtr ids, [In] ref IntPtr longNames, [In] ref int nNodes); /// /// Read the coordinates of the network branches. /// /// The NetCDF file id. /// The network id (in). /// The source node id (out). /// The target node id (out). /// The branch lengths (out). /// The branch ids (in). /// The branch names (in). /// The number of geometry points in each branch (out). /// The number of branches (in). /// TODO /// TODO [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_get_1d_network_branches", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_get_1d_network_branches_dll([In] ref int ioncid, [In] ref int networkid, [In, Out] ref IntPtr c_sourcenodeid, [In, Out] ref IntPtr c_targetnodeid, [In, Out] ref IntPtr c_branchlengths, [In] ref IntPtr ids, [In] ref IntPtr longNames, [In, Out] ref IntPtr c_nbranchgeometrypoints, [In] ref int nBranches, [In] ref int startIndex); /// /// Read the coordinates of the network branches. /// /// The NetCDF file id. /// The network id (in). /// The source node id (out). /// The target node id (out). /// The branch lengths (out). /// The branch ids (in). /// The branch names (in). /// The number of geometry points in each branch (out). /// The number of branches (in). /// TODO /// TODO [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_get_1d_network_branches_v1", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_get_1d_network_branches_v1_dll([In] ref int ioncid, [In] ref int networkid, [In, Out] ref IntPtr c_sourcenodeid, [In, Out] ref IntPtr c_targetnodeid, [In, Out] ref IntPtr c_branchlengths, [In] ref IntPtr ids, [In] ref IntPtr longNames, [In, Out] ref IntPtr c_nbranchgeometrypoints, [In] ref int nBranches, [In] ref int startIndex); /// /// Reads the branch geometry. /// /// The NetCDF file id. /// The network id (in). /// The x coordinates of the geometry points (out). /// The y coordinates of the geometry points (out). /// The number of nodes (in). /// TODO [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_read_1d_network_branches_geometry", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_read_1d_network_branches_geometry_dll([In] ref int ioncid, [In] ref int networkid, [In, Out] ref IntPtr c_geopointsX, [In, Out] ref IntPtr c_geopointsY, [In] ref int nGeometrypoints); /// /// Get the number of mesh discretisation points. /// /// The NetCDF file id (in). /// The mesh id in the specified data set (in). /// The number of mesh points (out). /// TODO [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_get_1d_mesh_discretisation_points_count", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_get_1d_mesh_discretisation_points_count_dll([In] ref int ioncid, [In] ref int meshId, [In, Out] ref int nmeshpoints); /// /// Read the coordinates of the mesh points. /// /// The NetCDF file id (in). /// The mesh id in the specified data set (in). /// The branch id for each mesh point (out). /// The offset along the branch from the starting point (out). /// The number of mesh points (in). /// TODO /// TODO [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_get_1d_mesh_discretisation_points", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_get_1d_mesh_discretisation_points_dll([In] ref int ioncid, [In] ref int networkid, [In, Out] ref IntPtr c_branchidx, [In, Out] ref IntPtr c_offset, [In, Out] ref IntPtr ids, [In, Out] ref IntPtr longNames, [In] ref int nmeshpoints, [In] ref int startIndex); /// /// Read the coordinates of the mesh points. /// /// The NetCDF file id (in). /// The mesh id in the specified data set (in). /// The branch id for each mesh point (out). /// The offset along the branch from the starting point (out). /// The number of mesh points (in). /// TODO /// TODO /// TODO /// TODO [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_get_1d_mesh_discretisation_points_v2", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_get_1d_mesh_discretisation_points_v2_dll([In] ref int ioncid, [In] ref int meshId, [In, Out] ref IntPtr c_branchidx, [In, Out] ref IntPtr c_offset, [In, Out] ref IntPtr ids, [In, Out] ref IntPtr longNames, [In] ref int nmeshpoints, [In] ref int startIndex, [In, Out] ref IntPtr c_coordx, [In, Out] ref IntPtr c_coordy); /// /// Read the coordinates of the mesh points. /// /// The NetCDF file id (in). /// The mesh id in the specified data set (in). /// The branch id for each mesh point (out). /// The offset along the branch from the starting point (out). /// The number of mesh points (in). /// TODO /// TODO /// TODO /// TODO [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_get_1d_mesh_discretisation_points_v1", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_get_1d_mesh_discretisation_points_v1_dll([In] ref int ioncid, [In] ref int meshId, [In, Out] ref IntPtr c_branchidx, [In, Out] ref IntPtr c_offset, [In, Out] ref IntPtr ids, [In, Out] ref IntPtr longNames, [In] ref int nmeshpoints, [In] ref int startIndex, [In, Out] ref IntPtr c_coordx, [In, Out] ref IntPtr c_coordy); /// /// Defines the contacts structure. /// /// The NetCDF file id (in). /// The id of the linksmesh (out). /// The name of the link (in). /// The number of contacts (in). /// The id of the first connecting mesh (in). /// The id of the second connecting mesh (in). /// The location type for the first mesh: 0, 1, 2 for node, edge, face respectively (in). /// The location type for the second mesh (in). /// TODO [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_def_mesh_contact", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_def_mesh_contact_dll([In] ref int ioncid, [In, Out] ref int linkmesh, string linkmeshname, [In] ref int ncontacts, [In] ref int mesh1, [In] ref int mesh2, [In] ref int locationType1Id, [In] ref int locationType2Id); /// /// Puts the contacts structure. /// /// The NetCDF file id (in). /// The id of the link mesh (in). /// The mesh1 indexes (in). /// The mesh2 indexes (in). /// type of link. /// The contact / link ids (in). /// The contact / link names (in). /// The number of contacts (in). /// TODO /// TODO [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_put_mesh_contact", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_put_mesh_contact_dll([In] ref int ioncid, [In] ref int contactsmesh, [In] ref IntPtr c_mesh1indexes, [In] ref IntPtr c_mesh2indexes, [In] ref IntPtr c_contacttype, [In, Out] ref IntPtr ids, [In, Out] ref IntPtr longNames, [In] ref int ncontacts, [In] ref int startIndex); /// /// Puts the contacts structure. /// /// The NetCDF file id (in). /// The id of the link mesh (in). /// The mesh1 indexes (in). /// The mesh2 indexes (in). /// type of link. /// The contact / link ids (in). /// The contact / link names (in). /// The number of contacts (in). /// TODO /// TODO [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_put_mesh_contact_v1", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_put_mesh_contact_v1_dll([In] ref int ioncid, [In] ref int contactsmesh, [In] ref IntPtr c_mesh1indexes, [In] ref IntPtr c_mesh2indexes, [In] ref IntPtr c_contacttype, [In, Out] ref IntPtr ids, [In, Out] ref IntPtr longNames, [In] ref int ncontacts, [In] ref int startIndex); /// /// Get the number of contacts from a specific linkmesh. /// /// The NetCDF file id (in). /// The id of the linkmesh (in). /// The number of contacts (out). /// TODO [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_get_contacts_count", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_get_contacts_count_dll([In] ref int ioncid, [In] ref int linkmesh, [In, Out] ref int nlinks); /// /// Get the the mesh contacts ids from a specific linkmesh. /// /// The NetCDF file id (in). /// The id of the linkmesh (in). /// The mesh1 indexes (out). /// The mesh2 indexes (out). /// Link type. /// The contact / link ids (in). /// The contact / link names (in). /// The number of contacts (in). /// TODO /// TODO [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_get_mesh_contact", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_get_mesh_contact_dll([In] ref int ioncid, [In] ref int contactsmesh, [In, Out] ref IntPtr c_mesh1indexes, [In, Out] ref IntPtr c_mesh2indexes, [In, Out] ref IntPtr c_contacttype, [In, Out] ref IntPtr ids, [In, Out] ref IntPtr longNames, [In] ref int ncontacts, [In] ref int startIndex); /// /// Get the the mesh contacts ids from a specific linkmesh. /// /// The NetCDF file id (in). /// The id of the linkmesh (in). /// The mesh1 indexes (out). /// The mesh2 indexes (out). /// Link type. /// The contact / link ids (in). /// The contact / link names (in). /// The number of contacts (in). /// TODO /// TODO [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_get_mesh_contact_v1", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_get_mesh_contact_v1_dll([In] ref int ioncid, [In] ref int contactsmesh, [In, Out] ref IntPtr c_mesh1indexes, [In, Out] ref IntPtr c_mesh2indexes, [In, Out] ref IntPtr c_contacttype, [In, Out] ref IntPtr ids, [In, Out] ref IntPtr longNames, [In] ref int ncontacts, [In] ref int startIndex); /// /// Clone the definitions specific mesh from one NetCDF file to another NetCDF. /// Clones all related attributes of the mesh, but it can not clone mesh contacts yet! /// /// The input NetCDF file id containing the mesh to clone (in). /// The output NetCDF file id, can be empty/not empty (in). /// The mesh id to copy (in). /// The id of the cloned mesh in the output file (out). /// TODO [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_clone_mesh_definition", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_clone_mesh_definition_dll([In] ref int ncidin, [In] ref int ncidout, [In] ref int meshidin, [In, Out] ref int meshidout); /// /// Clone the data of a specific mesh from one NetCDF file to another NetCDF. /// /// The input NetCDF file id containing the mesh to clone (in). /// The output NetCDF file id, can be empty/not empty (in). /// The mesh id to copy (in.) /// The id of the cloned mesh in the output file (out). /// TODO [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_clone_mesh_data", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_clone_mesh_data_dll([In] ref int ncidin, [In] ref int ncidout, [In] ref int meshidin, [In] ref int meshidout); /// /// Gets the number of networks. /// /// TODO /// TODO /// TODO [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_get_number_of_networks", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_get_number_of_networks_dll([In] ref int ioncid, [In, Out] ref int nnumNetworks); /// /// Gets the number of meshes. /// /// TODO /// Mesh type: 0 = any type, 1 = 1D mesh, 2 = 2D mesh, 3 = 3D mesh. /// TODO /// TODO [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_get_number_of_meshes", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_get_number_of_meshes_dll([In] ref int ioncid, [In] ref int meshType, [In, Out] ref int numMeshes); /// /// Get the network ids. /// /// TODO /// TODO /// TODO /// TODO [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_get_network_ids", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_get_network_ids_dll([In] ref int ncidin, [In, Out] ref IntPtr c_networkids, [In] ref int nnumNetworks); /// /// Gets the mesh ids. /// /// TODO /// TODO /// TODO /// TODO /// TODO [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_ug_get_mesh_ids", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_ug_get_mesh_ids_dll([In] ref int ioncid, [In] ref int meshType, [In, Out] ref IntPtr pointerToMeshIds, [In] ref int nnumNetworks); [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_put_1d_network_branchorder", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_put_1d_network_branchorder_dll([In] ref int ioncId, [In] ref int networkId, [In] ref IntPtr pointerToBranchOrder, [In] ref int numberOfBranches); [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_get_1d_network_branchorder", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_get_1d_network_branchorder_dll([In] ref int ioncId, [In] ref int networkId, [In, Out] ref IntPtr pointerToBranchOrder, [In] ref int numberOfBranches); [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_get_network_id_from_mesh_id", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_get_network_id_from_mesh_id_dll([In] ref int ioncid, [In] ref int meshId, [In, Out] ref int networkid); [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_get_contact_id", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_get_contact_id_dll([In] ref int ioncid, [In] ref int contactId); [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_def_mesh_ids", CallingConvention = CallingConvention.Cdecl)] private static extern int ionc_def_mesh_ids_dll([In] ref int ioncid, [In] ref int meshid, [In] ref int iloctype); [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_put_var_chars", CallingConvention = CallingConvention.Cdecl)] public static extern int ionc_put_var_chars_dll([In] ref int ioncid, [In] ref int meshid, [MarshalAs(UnmanagedType.LPStr)] [In, Out] StringBuilder varname, [In] ref IntPtr ids, [In] ref IntPtr longNames, [In] ref int nvalues); [DllImport(Helpers.IONetCDFConstants.IO_NETCDF_DLL_NAME, EntryPoint = "ionc_get_var_chars", CallingConvention = CallingConvention.Cdecl)] public static extern int ionc_get_var_chars_dll([In] ref int ioncid, [In] ref int meshid, [MarshalAs(UnmanagedType.LPStr)] [In, Out] StringBuilder varname, [In, Out] ref IntPtr ids, [In, Out] ref IntPtr longNames, [In] ref int nvalues); #endregion } }