Exemple #1
0
 /// <summary>
 /// Select elements in the user interface.
 /// </summary>
 public static int SelectViews(out int[] viewTags)
 {
     unsafe
     {
         int *viewTags_ptr;
         long viewTags_n = 0;
         var  index      = Gmsh_Warp.GmshFltkSelectViews(&viewTags_ptr, ref viewTags_n, ref Gmsh._staticreff);
         viewTags = UnsafeHelp.ToIntArray(viewTags_ptr, viewTags_n);
         Gmsh.CheckException(MethodBase.GetCurrentMethod().MethodHandle);
         return(index);
     }
 }
Exemple #2
0
 /// <summary>
 /// Split the model curve of tag `tag' on the control points `pointTags'.
 /// Return the tags `curveTags' of the newly created curves.
 /// </summary>
 public static int[] SplitCurve(int tag, int[] pointTags)
 {
     unsafe
     {
         int *pointTags_ptr;
         long pointTags_n = 0;
         Gmsh_Warp.GmshModelGeoSplitCurve(tag, pointTags, pointTags.LongLength, &pointTags_ptr, ref pointTags_n, ref Gmsh._staticreff);
         var curveTags = UnsafeHelp.ToIntArray(pointTags_ptr, pointTags_n);
         Gmsh.CheckException(MethodBase.GetCurrentMethod().MethodHandle);
         return(curveTags);
     }
 }
Exemple #3
0
 /// <summary>
 /// Get all the entities in the current model. If `dim' is >= 0, return only the
 /// entities of the specified dimension (e.g. points if `dim' == 0). The
 /// entities are returned as a vector of (dim, tag) integer pairs.
 /// </summary>
 public static ValueTuple <int, int>[] GetEntities(int dim = -1)
 {
     unsafe
     {
         int *dimTags_ptr;
         long dimTags_n = 0;
         Gmsh_Warp.GmshModelGetEntities(&dimTags_ptr, ref dimTags_n, dim, ref Gmsh._staticreff);
         var array = UnsafeHelp.ToIntArray(dimTags_ptr, dimTags_n);
         Gmsh.CheckException(MethodBase.GetCurrentMethod().MethodHandle);
         return(array.ToIntPair());
     }
 }
Exemple #4
0
 /// <summary>
 /// Select entities in the user interface. If `dim' is >= 0, return only the
 /// entities of the specified dimension (e.g. points if `dim' == 0).
 /// </summary>
 public static int SelectEntities(out ValueTuple <int, int>[] dimTags, int dim = -1)
 {
     unsafe
     {
         int *dimTags_ptr;
         long dimTags_n = 0;
         var  index     = Gmsh_Warp.GmshFltkSelectEntities(&dimTags_ptr, ref dimTags_n, dim, ref Gmsh._staticreff);
         dimTags = UnsafeHelp.ToIntArray(dimTags_ptr, dimTags_n).ToIntPair();
         Gmsh.CheckException(MethodBase.GetCurrentMethod().MethodHandle);
         return(index);
     }
 }
Exemple #5
0
 /// <summary>
 /// In a partitioned model, return the tags of the partition(s) to which the
 /// entity belongs.
 /// </summary>
 public static int[] GetPartitions(int dim, int tag)
 {
     unsafe
     {
         int *partitions_ptr;
         long partitions_n = default;
         Gmsh_Warp.GmshModelGetPartitions(dim, tag, &partitions_ptr, ref partitions_n, ref Gmsh._staticreff);
         var partitions = UnsafeHelp.ToIntArray(partitions_ptr, partitions_n);
         Gmsh.CheckException(MethodBase.GetCurrentMethod().MethodHandle);
         return(partitions);
     }
 }
Exemple #6
0
 /// <summary>
 /// Get the model entities in the bounding box defined by the two points
 /// (`xmin', `ymin', `zmin') and (`xmax', `ymax', `zmax'). If `dim' is >= 0,
 /// return only the entities of the specified dimension (e.g. points if `dim' ==
 /// 0).
 /// </summary>
 public static ValueTuple <int, int>[] GetEntitiesInBoundingBox(double xmin, double ymin, double zmin, double xmax, double ymax, double zmax, int dim = -1)
 {
     unsafe
     {
         int *tags_ptr;
         long tags_n = 0;
         Gmsh_Warp.GmshModelGetEntitiesInBoundingBox(xmin, ymin, zmin, xmax, ymax, zmax, &tags_ptr, ref tags_n, dim, ref Gmsh._staticreff);
         var pairs = UnsafeHelp.ToIntArray(tags_ptr, tags_n);
         Gmsh.CheckException(MethodBase.GetCurrentMethod().MethodHandle);
         return(pairs.ToIntPair());
     }
 }
Exemple #7
0
 /// <summary>
 /// Get the tags of the physical groups (if any) to which the model entity of
 /// dimension `dim' and tag `tag' belongs.
 /// </summary>
 public static int[] GetPhysicalGroupsForEntity(int dim, int tag)
 {
     unsafe
     {
         int *physicalTagsptr;
         long physicalTags_n = default;
         Gmsh_Warp.GmshModelGetPhysicalGroupsForEntity(dim, tag, &physicalTagsptr, ref physicalTags_n, ref Gmsh._staticreff);
         var physicalTags = UnsafeHelp.ToIntArray(physicalTagsptr, physicalTags_n);
         Gmsh.CheckException(MethodBase.GetCurrentMethod().MethodHandle);
         return(physicalTags);
     }
 }
Exemple #8
0
                /// <summary>
                /// Copy the entities `dimTags'; the new entities are returned in
                /// `outDimTags'.
                /// </summary>
                public static void Copy(ValueTuple <int, int>[] dimTags, out ValueTuple <int, int>[] outDimTags)
                {
                    long outcount = 0;
                    var  list     = dimTags.ToIntArray();

                    unsafe
                    {
                        int *ptrss;
                        Gmsh_Warp.GmshModelGeoCopy(list, list.LongLength, &ptrss, ref outcount, ref Gmsh._staticreff);
                        Gmsh.CheckException(MethodBase.GetCurrentMethod().MethodHandle);

                        var outDimTagsint = UnsafeHelp.ToIntArray(ptrss, outcount);
                        outDimTags = outDimTagsint.ToIntPair();
                    }
                }
Exemple #9
0
            /// <summary>
            /// Get the boundary of the model entities `dimTags'. Return in `outDimTags' the
            /// boundary of the individual entities (if `combined' is false) or the boundary
            /// of the combined geometrical shape formed by all input entities (if
            /// `combined' is true). Return tags multiplied by the sign of the boundary
            /// entity if `oriented' is true. Apply the boundary operator recursively down
            /// to dimension 0 (i.e. to points) if `recursive' is true.
            /// </summary>
            public static ValueTuple <int, int>[] GetBoundary(ValueTuple <int, int>[] dimTags, bool combined = true, bool oriented = true, bool recursive = false)
            {
                unsafe
                {
                    int *outDimTagsptr;
                    long outdimTags_n = 0;
                    var  dimarray     = dimTags.ToIntArray();
                    Gmsh_Warp.GmshModelGetBoundary(dimarray, dimarray.LongLength, &outDimTagsptr, ref outdimTags_n, Convert.ToInt32(combined), Convert.ToInt32(oriented), Convert.ToInt32(recursive), ref Gmsh._staticreff);

                    var array      = UnsafeHelp.ToIntArray(outDimTagsptr, outdimTags_n);
                    var outDimTags = array.ToIntPair();

                    Gmsh.CheckException(MethodBase.GetCurrentMethod().MethodHandle);
                    return(outDimTags);
                }
            }
Exemple #10
0
            /// <summary>
            /// Add homogeneous model-based post-processing data to the view with tag `tag'.
            /// The arguments have the same meaning as in `addModelData', except that `data'
            /// is supposed to be homogeneous and is thus flattened in a single vector. For
            /// data types that can lead to different data sizes per tag (like
            /// "ElementNodeData"), the data should be padded.
            /// </summary>
            public static void GetListData(int tag, out string[] dataType, out int[] numElements, out double[][] data)
            {
                unsafe
                {
                    byte **  dataType_ptr;
                    long     dataType_n = 0;
                    int *    numElements_ptr;
                    long     numElements_n = 0;
                    double **data_ptr;
                    long *   data_n_ptr;
                    long     data_nn = 0;

                    Gmsh_Warp.GmshViewGetListData(tag, &dataType_ptr, ref dataType_n, &numElements_ptr, ref numElements_n, &data_ptr, &data_n_ptr, ref data_nn, ref Gmsh._staticreff);
                    dataType    = UnsafeHelp.ToString(dataType_ptr, dataType_n);
                    numElements = UnsafeHelp.ToIntArray(numElements_ptr, numElements_n);
                    data        = UnsafeHelp.ToDoubleArray(data_ptr, data_n_ptr, data_nn);
                    Gmsh.CheckException(MethodBase.GetCurrentMethod().MethodHandle);
                }
            }
Exemple #11
0
                /// <summary>
                /// Extrude the model entities `dimTags' by a combined translation and
                /// rotation of `angle' radians, along (`dx', `dy', `dz') and around the axis
                /// of revolution defined by the point (`x', `y', `z') and the direction
                /// (`ax', `ay', `az'). The angle should be strictly smaller than Pi. Return
                /// extruded entities in `outDimTags'. If `numElements' is not empty, also
                /// extrude the mesh: the entries in `numElements' give the number of elements
                /// in each layer. If `height' is not empty, it provides the (cumulative)
                /// height of the different layers, normalized to 1.
                /// </summary>
                public static void Twist(ValueTuple <int, int>[] dimTags, double x, double y, double z, double dx, double dy, double dz, double ax, double ay, double az, double angle, out ValueTuple <int, int>[] outDimTags, int[] numElements = default, double[] heights = default, bool recombine = false)
                {
                    var dimarray = dimTags.ToIntArray();

                    unsafe
                    {
                        int *ptrss;
                        long outcount = 0;
                        if (numElements == default)
                        {
                            numElements = new int[0];
                        }
                        if (heights == default)
                        {
                            heights = new double[0];
                        }
                        Gmsh_Warp.GmshModelGeoTwist(dimarray, dimarray.LongLength, x, y, z, dx, dy, dz, ax, ay, az, angle, &ptrss, ref outcount, numElements, numElements.LongLength, heights, heights.LongLength, Convert.ToInt32(recombine), ref Gmsh._staticreff);

                        var array = UnsafeHelp.ToIntArray(ptrss, outcount);
                        outDimTags = array.ToIntPair();
                        Gmsh.CheckException(MethodBase.GetCurrentMethod().MethodHandle);
                    }
                }