/// <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'. /// </summary> /// <param name="dimTags"></param> /// <param name="x"></param> /// <param name="y"></param> /// <param name="z"></param> /// <param name="dx"></param> /// <param name="dy"></param> /// <param name="dz"></param> /// <param name="ax"></param> /// <param name="ay"></param> /// <param name="az"></param> /// <param name="angle"></param> /// <param name="outDimTags"></param> /// <param name="numElements"> If `numElements' is not empty, also extrude the mesh: the entries in `numElements' give the number of elements in each layer. </param> /// <param name="heights"> If `height' is not empty, it provides the (cumulative) height of the different layers, normalized to 1. </param> /// <param name="recombine"></param> public static void Twist(Tuple <int, int>[] dimTags, double x, double y, double z, double dx, double dy, double dz, double ax, double ay, double az, double angle, out Tuple <int, int>[] outDimTags, int[] numElements = default, double[] heights = default, bool recombine = false) { IntPtr out_DimTags; long outDimTags_n; var arr = IHelpers.FlattenIntTupleArray(dimTags); if (numElements == default) { numElements = new int[0]; } if (heights == default) { heights = new double[0]; } IWrap.GmshModelGeoTwist(arr, arr.LongLength, x, y, z, dx, dy, dz, ax, ay, az, angle, out out_DimTags, out outDimTags_n, numElements, numElements.LongLength, heights, heights.LongLength, Convert.ToInt32(recombine), ref _ierr); outDimTags = new Tuple <int, int> [0]; if (outDimTags_n > 0) { var temp = new int[outDimTags_n]; Marshal.Copy(out_DimTags, temp, 0, (int)outDimTags_n); outDimTags = IHelpers.GraftIntTupleArray(temp); } IWrap.GmshFree(out_DimTags); }
/// <summary> /// Copy the entities `dimTags'; the new entities are returned in `outDimTags'. /// </summary> /// <param name="dimTags"></param> /// <param name="outDimTags"></param> public static void Copy(Tuple <int, int>[] dimTags, out Tuple <int, int>[] outDimTags) { IntPtr dimTags_parse; long outDimTags_n; var tagsArr = IHelpers.FlattenIntTupleArray(dimTags); IWrap.GmshModelGeoCopy(tagsArr, tagsArr.LongLength, out dimTags_parse, out outDimTags_n, ref _ierr); outDimTags = new Tuple <int, int> [0]; if (outDimTags_n > 0) { var temp = new int[outDimTags_n]; Marshal.Copy(dimTags_parse, temp, 0, (int)outDimTags_n); outDimTags = IHelpers.GraftIntTupleArray(temp); } Free(dimTags_parse); }
/// <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 void GetBoundary(Tuple <int, int>[] dimTags, out Tuple <int, int>[] outDimTags, bool combined = false, bool oriented = false, bool recursive = false) { int[] dimTags_flatten = IHelpers.FlattenIntTupleArray(dimTags); IntPtr outDimTags_parse; long outDimTags_n; IWrap.GmshModelGetBoundary(dimTags_flatten, dimTags_flatten.LongLength, out outDimTags_parse, out outDimTags_n, Convert.ToInt32(combined), Convert.ToInt32(oriented), Convert.ToInt32(recursive), ref _ierr); outDimTags = new Tuple <int, int> [0]; if (outDimTags_n > 0) { var temp = new int[outDimTags_n]; Marshal.Copy(outDimTags_parse, temp, 0, (int)outDimTags_n); outDimTags = IHelpers.GraftIntTupleArray(temp); } IWrap.GmshFree(outDimTags_parse); }
/// <summary> /// Scale the model entities `dimTag' by factors `a', `b' and `c' along the /// three coordinate axes; use(`x', `y', `z') as the center of the homothetic transformation. /// </summary> public static void Dilate(Tuple <int, int>[] dimTags, double x, double y, double z, double a, double b, double c) { var arr = IHelpers.FlattenIntTupleArray(dimTags); IWrap.GmshModelGeoDilate(arr, arr.LongLength, x, y, z, a, b, c, ref _ierr); }
/// <summary> /// Rotate the model entities `dimTags' of `angle' radians around the axis of /// revolution defined by the point(`x', `y', `z') and the direction (`ax',`ay', `az'). /// </summary> public static void Rotate(Tuple <int, int>[] dimTags, double x, double y, double z, double ax, double ay, double az, double angle) { var tagsArr = IHelpers.FlattenIntTupleArray(dimTags); IWrap.GmshModelGeoRotate(tagsArr, tagsArr.LongLength, x, y, z, ax, ay, az, angle, ref _ierr); }
/// <summary> /// Translate the model entities `dimTags' along (`dx', `dy', `dz'). /// </summary> public static void Translate(Tuple <int, int>[] dimTags, double dx, double dy, double dz) { var tagsArr = IHelpers.FlattenIntTupleArray(dimTags); IWrap.GmshModelGeoTranslate(tagsArr, tagsArr.LongLength, dx, dy, dz, ref _ierr); }
/// <summary> /// Set a mesh size constraint on the model entities `dimTags'. Currently only /// entities of dimension 0 (points) are handled. /// </summary> public static void SetSize(Tuple <int, int>[] dimTags, double size) { var arr = IHelpers.FlattenIntTupleArray(dimTags); IWrap.GmshModelGeoMeshSetSize(arr, arr.LongLength, size, ref _ierr); }
/// <summary> /// Remove the entities `dimTags'. If `recursive' is true, remove all the entities on their boundaries, down to dimension 0. /// </summary> public static void Remove(Tuple <int, int>[] dimTags, bool recursive = false) { var arr = IHelpers.FlattenIntTupleArray(dimTags); IWrap.GmshModelGeoRemove(arr, arr.LongLength, Convert.ToInt32(recursive), ref _ierr); }
/// <summary> /// Mirror the model entities `dimTag', with respect to the plane of equation /// `a' * x + `b' * y + `c' * z + `d' = 0. (This is a synonym for `mirror', /// which will be deprecated in a future release.) /// </summary> public static void Symmetrize(Tuple <int, int>[] dimTags, double a, double b, double c, double d) { var arr = IHelpers.FlattenIntTupleArray(dimTags); IWrap.GmshModelGeoSymmetrize(arr, arr.LongLength, a, b, c, d, ref _ierr); }
/// <summary> /// Remove the physical groups `dimTags' of the current model. If `dimTags' is empty, remove all groups. /// </summary> public static void RemovePhysicalGroups(Tuple <int, int>[] dimTags) { var arr = IHelpers.FlattenIntTupleArray(dimTags); IWrap.GmshModelRemovePhysicalGroups(arr, arr.LongLength, ref _ierr); }
/// <summary> /// Set the color of the model entities `dimTags' to the RGBA value (`r', `g', /// `b', `a'), where `r', `g', `b' and `a' should be integers between 0 and /// 255. Apply the color setting recursively if `recursive' is true. /// </summary> public static void SetColor(Tuple <int, int>[] dimTags, int r, int g, int b, int a = 255, bool recursive = false) { var arr = IHelpers.FlattenIntTupleArray(dimTags); IWrap.GmshModelSetColor(arr, arr.LongLength, r, g, b, a, Convert.ToInt32(recursive), ref _ierr); }