Exemplo n.º 1
0
 /// <summary>
 /// Evaluate the principal curvatures of the surface with tag `tag' at the
 /// parametric coordinates `parametricCoord', as well as their respective
 /// directions. `parametricCoord' are given by pair of u and v coordinates,
 /// concatenated: [p1u, p1v, p2u, ...].
 /// </summary>
 public static void GetPrincipalCurvatures(int dim, double[] parametricCoord, out double[] curvatureMax, out double[] curvatureMin, out double[] directionMax, out double[] directionMin)
 {
     unsafe
     {
         double *curvatureMax_ptr;
         long    curvatureMax_n = 0;
         double *curvatureMin_ptr;
         long    curvatureMin_n = 0;
         double *directionMax_ptr;
         long    directionMax_n = 0;
         double *directionMin_ptr;
         long    directionMin_n = 0;
         Gmsh_Warp.GmshModelGetPrincipalCurvatures(dim, parametricCoord, parametricCoord.LongLength,
                                                   &curvatureMax_ptr, ref curvatureMax_n,
                                                   &curvatureMin_ptr, ref curvatureMin_n,
                                                   &directionMax_ptr, ref directionMax_n,
                                                   &directionMin_ptr, ref directionMin_n,
                                                   ref Gmsh._staticreff);
         curvatureMax = UnsafeHelp.ToDoubleArray(curvatureMax_ptr, curvatureMax_n);
         curvatureMin = UnsafeHelp.ToDoubleArray(curvatureMin_ptr, curvatureMin_n);
         directionMax = UnsafeHelp.ToDoubleArray(directionMax_ptr, directionMax_n);
         directionMin = UnsafeHelp.ToDoubleArray(directionMin_ptr, directionMin_n);
         Gmsh.CheckException(MethodBase.GetCurrentMethod().MethodHandle);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Specialized Add for PFN cache
        /// </summary>
        /// <param name="Key">Must be pre-shifted, upper 16 bits are used for ref counting</param>
        /// <param name="Value">YOU MAY NOT ENTER FREEKING NULL PAGES INTO THE CACHE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</param>
        /// <returns></returns>
        public static new bool TryAdd(long Key, long[] Value)
        {
            if (Value == null)
            {
                return(false);
            }

            // leave some wiggle room for other threads so maybe we don't block too much
            if ((Global.Count + RemovalRateBar) >= Capacity)
            {
                var next_remove = (from entry in Global.Keys
                                   where (((entry >> 48) & 0xffff) <= 2)                                                           // instead of 2 I should really keep an average ref count
                                   select entry).Take(RemovalRate).AsParallel().All(taken => Global.TryRemove(taken, out OutVar)); // 1% by default

                // might be a good idea to reduce the current count of all entries by 1/2 to ensure liveness
                // but this whole thing should be relatively short lived I don't foresee a huge population of max-aged items
            }

            if (UnsafeHelp.IsZero(Value))
            {
                return(false);
            }

            return(Global.TryAdd(Key, Value));
        }
Exemplo n.º 3
0
        public static IEnumerable <Tuple <ulong, string> > SimpleRegex(Regex re, DetectedProc dp, bool MatchAscii = true, bool MatchUTF16 = false, bool MatchUTF8 = false)
        {
            byte[]          block4k  = new byte[PAGE_SIZE];
            byte[]          block2MB = new byte[LARGE_PAGE_SIZE];
            string          s        = string.Empty;
            MatchCollection mc       = null;

            dp.MemAccess.ResetDumpBitmap();

            foreach (var entry in dp.PT.FillPageQueue(false, true, true, false))
            {
                if (dp.MemAccess.IsDumpedPFN(entry.PTE))
                {
                    continue;
                }
                dp.MemAccess.SetDumpedPFN(entry.PTE);

                bool   GotData = false;
                byte[] block   = entry.PTE.LargePage ? block2MB : block4k;

                dp.MemAccess.GetPageForPhysAddr(entry.PTE, ref block, ref GotData);

                if (!GotData ||
                    UnsafeHelp.IsZeroPage(block) == 0 ||
                    UnsafeHelp.IsFFFPage(block) == 0)
                {
                    continue;
                }

                if (MatchAscii)
                {
                    s  = Encoding.ASCII.GetString(block, 0, block.Length);
                    mc = re.Matches(s);
                    foreach (Match m in mc)
                    {
                        yield return(Tuple.Create <ulong, string>(entry.VA.FullAddr + (uint)m.Index, m.Value));
                    }
                }
                if (MatchUTF16)
                {
                    s  = Encoding.Unicode.GetString(block, 0, block.Length);
                    mc = re.Matches(s);
                    foreach (Match m in mc)
                    {
                        yield return(Tuple.Create <ulong, string>(entry.VA.FullAddr + (uint)m.Index, m.Value));
                    }
                }
                if (MatchUTF8)
                {
                    s  = Encoding.UTF8.GetString(block, 0, block.Length);
                    mc = re.Matches(s);
                    foreach (Match m in mc)
                    {
                        yield return(Tuple.Create <ulong, string>(entry.VA.FullAddr + (uint)m.Index, m.Value));
                    }
                }
            }
            yield break;
        }
Exemplo n.º 4
0
 /// <summary>
 /// Get the name of the current model.
 /// </summary>
 public static string GetCurrent()
 {
     unsafe
     {
         byte *nameptr;
         Gmsh_Warp.GmshModelGetCurrent(&nameptr, ref Gmsh._staticreff);
         var array = UnsafeHelp.ToString(nameptr);
         Gmsh.CheckException(MethodBase.GetCurrentMethod().MethodHandle);
         return(array);
     }
 }
Exemplo n.º 5
0
 /// <summary>
 /// Get the type of the entity of dimension `dim' and tag `tag'.
 /// </summary>
 public static string GetType(int dim, int tag)
 {
     unsafe
     {
         byte *entityTypeptr;
         Gmsh_Warp.GmshModelGetType(dim, tag, &entityTypeptr, ref Gmsh._staticreff);
         var typename = UnsafeHelp.ToString(entityTypeptr);
         Gmsh.CheckException(MethodBase.GetCurrentMethod().MethodHandle);
         return(typename);
     }
 }
Exemplo n.º 6
0
 /// <summary>
 /// Get the name of the physical group of dimension `dim' and tag `tag'.
 /// </summary>
 public static string GetPhysicalName(int dim, int tag)
 {
     unsafe
     {
         byte *nameptr;
         Gmsh_Warp.GmshModelGetPhysicalName(dim, tag, &nameptr, ref Gmsh._staticreff);
         var name = UnsafeHelp.ToString(nameptr);
         Gmsh.CheckException(MethodBase.GetCurrentMethod().MethodHandle);
         return(name);
     }
 }
Exemplo n.º 7
0
 /// <summary>
 /// Set one or more parameters in the ONELAB database, encoded in `format'.
 /// </summary>
 public static string Get(string name = "", string format = "json")
 {
     unsafe
     {
         byte *data_ptr;
         Gmsh_Warp.GmshOnelabGet(&data_ptr, name, format, ref Gmsh._staticreff);
         var data = UnsafeHelp.ToString(data_ptr);
         Gmsh.CheckException(MethodBase.GetCurrentMethod().MethodHandle);
         return(data);
     }
 }
Exemplo n.º 8
0
 /// <summary>
 /// Get the `value' of a string option. `name' is of the form "category.option"
 /// or "category[num].option". Available categories and options are listed in
 /// the Gmsh reference manual.
 /// </summary>
 public static string GetString(string name)
 {
     unsafe
     {
         byte *valueptr;
         Gmsh_Warp.GmshOptionGetString(name, &valueptr, ref Gmsh._staticreff);
         var value = UnsafeHelp.ToString(valueptr);
         Gmsh.CheckException(MethodBase.GetCurrentMethod().MethodHandle);
         return(value);
     }
 }
Exemplo n.º 9
0
 /// <summary>
 /// Get the parametric coordinates `parametricCoord' for the points `coord' on
 /// the entity of dimension `dim' and tag `tag'. `coord' are given as triplets
 /// of x, y, z coordinates, concatenated: [p1x, p1y, p1z, p2x, ...].
 /// `parametricCoord' returns the parametric coordinates t on the curve (if
 /// `dim' = 1) or pairs of u and v coordinates concatenated on the surface (if
 /// `dim' = 2), i.e. [p1t, p2t, ...] or [p1u, p1v, p2u, ...].
 /// </summary>
 public static double[] GetParametrization(int dim, int tag, double[] coord)
 {
     unsafe
     {
         double *ptr;
         long    outcount = 0;
         Gmsh_Warp.GmshModelGetParametrization(dim, tag, coord, coord.LongLength, &ptr, ref outcount, ref Gmsh._staticreff);
         var parametricCoord = UnsafeHelp.ToDoubleArray(ptr, outcount);
         Gmsh.CheckException(MethodBase.GetCurrentMethod().MethodHandle);
         return(parametricCoord);
     }
 }
Exemplo n.º 10
0
 /// <summary>
 /// Get the normal to the surface with tag `tag' at the parametric coordinates
 /// `parametricCoord'. `parametricCoord' are given by pairs of u and v
 /// coordinates, concatenated: [p1u, p1v, p2u, ...]. `normals' are returned as
 /// triplets of x, y, z components, concatenated: [n1x, n1y, n1z, n2x, ...].
 /// </summary>
 public static double[] GetNormal(int tag, double[] parametricCoord)
 {
     unsafe
     {
         double *ptr;
         long    outcount = 0;
         Gmsh_Warp.GmshModelGetNormal(tag, parametricCoord, parametricCoord.LongLength, &ptr, ref outcount, ref Gmsh._staticreff);
         var normals = UnsafeHelp.ToDoubleArray(ptr, outcount);
         Gmsh.CheckException(MethodBase.GetCurrentMethod().MethodHandle);
         return(normals);
     }
 }
Exemplo n.º 11
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);
     }
 }
Exemplo n.º 12
0
 /// <summary>
 /// List the names of all models.
 /// </summary>
 public static string[] List()
 {
     unsafe
     {
         byte **names_ptr;
         long   name_n = 0;
         Gmsh_Warp.GmshModelList(&names_ptr, ref name_n, ref Gmsh._staticreff);
         var names = UnsafeHelp.ToString(names_ptr, name_n);
         Gmsh.CheckException(MethodBase.GetCurrentMethod().MethodHandle);
         return(names);
     }
 }
Exemplo n.º 13
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());
     }
 }
Exemplo n.º 14
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);
     }
 }
Exemplo n.º 15
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);
     }
 }
Exemplo n.º 16
0
 /// <summary>
 /// Select elements in the user interface.
 /// </summary>
 public static int SelectElements(out long[] elementTags)
 {
     unsafe
     {
         long *elementTags_ptr;
         long  elementTags_n = 0;
         var   index         = Gmsh_Warp.GmshFltkSelectElements(&elementTags_ptr, ref elementTags_n, ref Gmsh._staticreff);
         elementTags = UnsafeHelp.ToLongArray(elementTags_ptr, elementTags_n);
         Gmsh.CheckException(MethodBase.GetCurrentMethod().MethodHandle);
         return(index);
     }
 }
Exemplo n.º 17
0
            /// <summary>
            /// Reparametrize the boundary entity (point or curve, i.e. with `dim' == 0 or
            /// `dim' == 1) of tag `tag' on the surface `surfaceTag'. If `dim' == 1,
            /// reparametrize all the points corresponding to the parametric coordinates
            /// `parametricCoord'. Multiple matches in case of periodic surfaces can be
            /// selected with `which'. This feature is only available for a subset of
            /// entities, depending on the underyling geometrical representation.
            /// </summary>
            public static void ReparametrizeOnSurface(int dim, int tag, double[] parametricCoord, int surfaceTag, out double[] surfaceParametricCoord, int which = 0)
            {
                unsafe
                {
                    double *surfaceParametricCoord_ptr;
                    long    surfaceParametricCoord_n = 0;

                    Gmsh_Warp.GmshModelReparametrizeOnSurface(dim, tag, parametricCoord, parametricCoord.LongLength, surfaceTag, &surfaceParametricCoord_ptr, ref surfaceParametricCoord_n, which, ref Gmsh._staticreff);
                    surfaceParametricCoord = UnsafeHelp.ToDoubleArray(surfaceParametricCoord_ptr, surfaceParametricCoord_n);
                    Gmsh.CheckException(MethodBase.GetCurrentMethod().MethodHandle);
                }
            }
Exemplo n.º 18
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);
     }
 }
Exemplo n.º 19
0
 /// <summary>
 /// Get the value of the string parameter `name' from the ONELAB database.
 /// Return an empty vector if the parameter does not exist.
 /// </summary>
 public static string[] GetString(string name)
 {
     unsafe
     {
         byte **valueptr;
         long   value_n = 0;
         Gmsh_Warp.GmshOnelabGetString(name, &valueptr, ref value_n, ref Gmsh._staticreff);
         var value = UnsafeHelp.ToString(valueptr, value_n);
         Gmsh.CheckException(MethodBase.GetCurrentMethod().MethodHandle);
         return(value);
     }
 }
Exemplo n.º 20
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);
     }
 }
Exemplo n.º 21
0
 /// <summary>
 /// Get the value of the number parameter `name' from the ONELAB database.
 /// Return an empty vector if the parameter does not exist.
 /// </summary>
 public static double[] GetNumber(string name)
 {
     unsafe
     {
         double *value_ptr;
         long    value_n = 0;
         Gmsh_Warp.GmshOnelabGetNumber(name, &value_ptr, ref value_n, ref Gmsh._staticreff);
         var value = UnsafeHelp.ToDoubleArray(value_ptr, value_n);
         Gmsh.CheckException(MethodBase.GetCurrentMethod().MethodHandle);
         return(value);
     }
 }
Exemplo n.º 22
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());
     }
 }
Exemplo n.º 23
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();
                    }
                }
Exemplo n.º 24
0
            /// <summary>
            /// Get the `min' and `max' bounds of the parametric coordinates for the entity
            /// of dimension `dim' and tag `tag'.
            /// </summary>
            public static void GetParametrizationBounds(int dim, int tag, out double[] min, out double[] max)
            {
                unsafe
                {
                    double *min_ptr;
                    long    min_n = 0;
                    double *max_ptr;
                    long    max_n = 0;

                    Gmsh_Warp.GmshModelGetParametrizationBounds(dim, tag, &min_ptr, ref min_n, &max_ptr, ref max_n, ref Gmsh._staticreff);
                    min = UnsafeHelp.ToDoubleArray(min_ptr, min_n);
                    max = UnsafeHelp.ToDoubleArray(max_ptr, max_n);
                    Gmsh.CheckException(MethodBase.GetCurrentMethod().MethodHandle);
                }
            }
Exemplo n.º 25
0
            /// <summary>
            /// Get the points `closestCoord' on the entity of dimension `dim' and tag `tag'
            /// to the points `coord', by orthogonal projection. `coord' and `closestCoord'
            /// are given as triplets of x, y, z coordinates, concatenated: [p1x, p1y, p1z,
            /// p2x, ...]. `parametricCoord' returns the parametric coordinates t on the
            /// curve (if `dim' = 1) or pairs of u and v coordinates concatenated on the
            /// surface (if `dim' = 2), i.e. [p1t, p2t, ...] or [p1u, p1v, p2u, ...].
            /// </summary>
            public static void GetClosestPoint(int dim, int tag, double[] coord, out double[] closestCoord, out double[] parametricCoord)
            {
                unsafe
                {
                    double *closestCoord_ptr;
                    long    closestCoord_n = 0;
                    double *parametricCoord_ptr;
                    long    parametricCoord_n = 0;

                    Gmsh_Warp.GmshModelGetClosestPoint(dim, tag, coord, coord.LongLength, &closestCoord_ptr, ref closestCoord_n, &parametricCoord_ptr, ref parametricCoord_n, ref Gmsh._staticreff);
                    closestCoord    = UnsafeHelp.ToDoubleArray(closestCoord_ptr, closestCoord_n);
                    parametricCoord = UnsafeHelp.ToDoubleArray(parametricCoord_ptr, parametricCoord_n);
                    Gmsh.CheckException(MethodBase.GetCurrentMethod().MethodHandle);
                }
            }
Exemplo n.º 26
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);
                }
            }
Exemplo n.º 27
0
            /// <summary>
            /// Get list-based post-processing data strings (2D strings if `dim' = 2, 3D
            /// strings if `dim' = 3) from the view with tag `tag'. Return the coordinates
            /// in `coord', the strings in `data' and the styles in `style'.
            /// </summary>
            public static void GetListDataStrings(int tag, int dim, out double[] coord, out string[] data, out string[] style)
            {
                unsafe
                {
                    double *coord_ptr;
                    long    coord_n = 0;
                    byte ** data_ptr;
                    long    data_n = 0;
                    byte ** style_ptr;
                    long    style_n = 0;

                    Gmsh_Warp.GmshViewGetListDataStrings(tag, dim, &coord_ptr, ref coord_n, &data_ptr, ref data_n, &style_ptr, ref style_n, ref Gmsh._staticreff);
                    coord = UnsafeHelp.ToDoubleArray(coord_ptr, coord_n);
                    data  = UnsafeHelp.ToString(data_ptr, data_n);
                    style = UnsafeHelp.ToString(style_ptr, style_n);
                    Gmsh.CheckException(MethodBase.GetCurrentMethod().MethodHandle);
                }
            }
Exemplo n.º 28
0
            /// <summary>
            /// Get logged messages.
            /// </summary>
            public static string[] Get()
            {
                unsafe
                {
                    byte **errorptr;
                    long   log_n = 0;
                    Gmsh_Warp.GmshLoggerGet(&errorptr, ref log_n, ref _staticreff);

                    var messages = UnsafeHelp.ToString(errorptr, log_n);
                    if (_staticreff != 0)
                    {
                        var method = MethodBase.GetCurrentMethod();
                        var where = $"{method.DeclaringType.FullName}.{method.Name}";
                        throw new GmshException("Could not get", where, _staticreff);
                    }
                    return(messages);
                }
            }
Exemplo n.º 29
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);
                }
            }
Exemplo n.º 30
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 GetModelData(int tag, int step, out string dataType, out long[] tags, out double[][] data, out double time, out int numComponents)
            {
                unsafe
                {
                    byte *   dataType_ptr;
                    long *   tags_ptr;
                    long     tags_n = 0;
                    double **data_ptr;
                    long *   data_n_ptr;
                    long     data_nn = 0;
                    time = 0; numComponents = 0;

                    Gmsh_Warp.GmshViewGetModelData(tag, step, &dataType_ptr, &tags_ptr, ref tags_n, &data_ptr, &data_n_ptr, ref data_nn, ref time, ref numComponents, ref Gmsh._staticreff);
                    dataType = UnsafeHelp.ToString(dataType_ptr);
                    tags     = UnsafeHelp.ToLongArray(tags_ptr, tags_n);
                    data     = UnsafeHelp.ToDoubleArray(data_ptr, data_n_ptr, data_nn);
                    Gmsh.CheckException(MethodBase.GetCurrentMethod().MethodHandle);
                }
            }