/// <summary> /// Remove all duplicate entities (different entities at the same geometrical location). /// </summary> public static void RemoveAllDuplicates() { IWrap.GmshModelGeoRemoveAllDuplicates(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> /// 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> /// Set the meshing algorithm on the model entity of dimension `dim' and tag `tag'. /// Currently only supported for `dim' == 2. /// </summary> /// <param name="dim"></param> /// <param name="tag"></param> /// <param name="val"></param> public static void SetAlgorithm(int dim, int tag, int val) { IWrap.GmshModelGeoMeshSetAlgorithm(dim, tag, val, ref _ierr); }
/// <summary> /// Synchronize the built-in CAD representation with the current IguanaGmsh model. /// This can be called at any time, but since it involves a non trivial amount of processing, the number of synchronization points should normally be minimized. /// </summary> public static void Synchronize() { IWrap.GmshModelGeoSynchronize(ref _ierr); }
/// <summary> /// Disposes this instance. /// </summary> internal void Dispose() { if (_disposed) return; _disposed = true; if (_item != null) { _item.RowNumberChanged -= OnRowNumberChanged; _item = null; } if (Cells != null) { while (Cells.Count > 0) { var cell = Cells.Last(); if (!cell.IsDisposed) cell.Dispose(); else Cells.Remove(cell); } Cells.Clear(); } if (_owner != null) { _owner.RemoveContainerFromDictionaryIfExists(this); _owner = null; } }
/// <summary> /// Set a smoothing meshing constraint on the model entity of dimension `dim' and tag `tag'. /// </summary> /// <param name="dim"></param> /// <param name="tag"></param> /// <param name="val"> `val' iterations of a Laplace smoother are applied. </param> public static void SetSmoothing(int dim, int tag, int val) { IWrap.GmshModelGeoMeshSetSmoothing(dim, tag, val, ref _ierr); }
/// <summary> /// Add a straight line segment between the two points with tags `startTag' and `endTag'. /// Return the tag of the line. /// </summary> /// <param name="startTag"> Tag of the starting point </param> /// <param name="endTag"> Tag of the end point </param> /// <param name="tag"> Line Tag. If `tag' is positive, set the tag explicitly; otherwise a new tag is selected automatically. </param> /// <returns></returns> public static int AddLine(int startTag, int endTag, int tag = -1) { return(IWrap.GmshModelGeoAddLine(startTag, endTag, tag, ref _ierr)); }
/// <summary> /// Add an ellipse arc (strictly smaller than Pi) between the two points `startTag' and `endTag', with center `centerTag' and major axis point `majorTag'. /// If(`nx', `ny', `nz') != (0, 0, 0), explicitly set the plane of the circle arc. /// Return the tag of the ellipse arc. /// </summary> /// <param name="startTag"></param> /// <param name="centerTag"></param> /// <param name="majorTag"></param> /// <param name="endTag"></param> /// <param name="tag"> If `tag' is positive, set the tag explicitly; otherwise a new tag is selected automatically. </param> /// <param name="nx"></param> /// <param name="ny"></param> /// <param name="nz"></param> /// <returns></returns> public static int AddEllipseArc(int startTag, int centerTag, int majorTag, int endTag, int tag = -1, double nx = 0.0, double ny = 0.0, double nz = 0.0) { return(IWrap.GmshModelGeoAddEllipseArc(startTag, centerTag, majorTag, endTag, tag, nx, ny, nz, ref _ierr)); }
/// <inheritdoc/> public bool Equals(IWrap other) { return(string.Equals(this.Class, other.Class)); }
/// <summary> /// Add a geometrical point in the built-in CAD representation, at coordinates (`x', `y', `z'). /// (Note that the point will be added in the current model only after `synchronize' is called. /// This behavior holds for all the entities added in the geo module.) /// Return the tag of the point. /// </summary> /// <param name="x"> X coordinate </param> /// <param name="y"> Y coordinate </param> /// <param name="z"> Z coordinate </param> /// <param name="meshSize"> If `meshSize' is > 0, add a meshing constraint at that point </param> /// <param name="tag"> Point Tag. If `tag' is positive, set the tag explicitly; otherwise a new tag is selected automatically </param> /// <returns></returns> public static int AddPoint(double x, double y, double z, double meshSize = -1, int tag = -1) { return(IWrap.GmshModelGeoAddPoint(x, y, z, meshSize, tag, ref _ierr)); }
/// <summary> /// Check if the user interface is available (e.g. to detect if it has been closed). /// </summary> /// <returns></returns> public static int FltkIsAvailable() { return(IWrap.GmshFltkIsAvailable(ref _ierr)); }
/// <summary> /// Run the event loop of the graphical user interface, i.e. repeatedly call /// `wait()'. First automatically create the user interface if it has not yet /// been initialized.Can only be called in the main thread. /// </summary> public static void FltkRun() { IWrap.GmshFltkRun(ref _ierr); }
/// <summary> /// Release the lock that was set using lock. /// </summary> public static void FltkUnlock() { IWrap.GmshFltkUnlock(ref _ierr); }
/// <summary> /// Gets the container from item. /// </summary> /// <param name="item">The item.</param> /// <returns>SpreadsheetItemContainer.</returns> public SpreadsheetItemContainer GetContainerFromItem(IWrap item) { SpreadsheetItemContainer container; _containersDict.TryGetValue(item, out container); return container; }
/// <summary> /// Add a closed polyline (a curve loop in gmsh) formed by the curves `curveTags'. /// Return the tag of the closed polyline. /// </summary> /// <param name="curveTags"> `curveTags' should contain (signed) tags of model enties of dimension 1 forming a closed loop: a negative tag signifies that the underlying curve is considered with reversed orientation. </param> /// <param name="tag"> Polyline Tag. If `tag' is positive, set the tag explicitly; otherwise a new tag is selected automatically. </param> /// <returns></returns> public static int AddCurveLoop(int[] curveTags, int tag = -1) { int tag_crv = IWrap.GmshModelGeoAddCurveLoop(curveTags, curveTags.Length, tag, ref _ierr); return(tag_crv); }
/// <summary> /// Populates the cells. /// </summary> /// <param name="ic">The ic.</param> /// <param name="item">The item.</param> private static void PopulateCells(SpreadsheetItemContainer ic, IWrap item) { ic.Item = item; ic.IsOdd = ic.Item.Index % 2 != 0; ic.SetIsAlternate(); }
/// <summary> /// Add a Bezier curve with `pointTags' control points. /// Return the tag of the Bezier curve. /// </summary> /// <param name="pointTags"> Tags of points constituing the polyline. </param> /// <param name="tag"> If `tag' is positive, set the tag explicitly; otherwise a new tag is selected automatically. </param> /// <returns></returns> public static int AddBezier(int[] pointTags, int tag = -1) { return(IWrap.GmshModelGeoAddBezier(pointTags, pointTags.LongLength, tag, ref _ierr)); }
/// <summary> /// Set a recombination meshing constraint on the model entity of dimension `dim' and tag `tag'. /// Currently only entities of dimension 2 (to recombine triangles into quadrangles) are supported. /// </summary> /// <param name="dim"></param> /// <param name="tag"></param> /// <param name="angle"></param> public static void SetRecombine(int dim, int tag, double angle) { IWrap.GmshModelGeoMeshSetRecombine(dim, tag, angle, ref _ierr); }
/// <summary> /// Add a b-spline with control points sampling the curves in `curveTags'. /// Return the tag of the b-spline. /// </summary> /// <param name="curveTags"> Tags of curves constituing the compund Spline. </param> /// <param name="numIntervals"> The density of sampling points on each curve. </param> /// <param name="tag"> If `tag' is positive, set the tag explicitly; otherwise a new tag is selected automatically. </param> /// <returns></returns> public static int AddCompoundBSpline(int[] curveTags, int numIntervals, int tag = -1) { return(IWrap.GmshModelGeoAddCompoundBSpline(curveTags, curveTags.LongLength, numIntervals, tag, ref _ierr)); }
/// <summary> /// Set a reverse meshing constraint on the model entity of dimension `dim' and tag `tag'. /// </summary> /// <param name="dim"></param> /// <param name="tag"></param> /// <param name="val"> If `val' is true, the mesh orientation will be reversed with respect to the natural mesh orientation(i.e.the orientation consistent with the orientation of the geometry). /// If `val' is false, the mesh is left as-is. </param> public static void SetReverse(int dim, int tag, bool val) { IWrap.GmshModelGeoMeshSetReverse(dim, tag, Convert.ToInt32(val), ref _ierr); }
/// <summary> /// Add a plane surface defined by one or more closed polylines. /// </summary> /// <param name="wireTags"> The first closed polyline in `wireTags' defines the exterior contour; additional curve loop define holes. </param> /// <param name="tag"> If `tag' is positive, set the tag explicitly; otherwise a new tag is selected automatically.Return the tag of the surface. </param> /// <returns></returns> public static int AddPlaneSurface(int[] wireTags, int tag = -1) { return(IWrap.GmshModelGeoAddPlaneSurface(wireTags, wireTags.LongLength, tag, ref _ierr)); }
/// <summary> /// Force the mesh size to be extended from the boundary, or not, for the model entity of dimension `dim' and tag `tag'. /// Currently only supported for `dim' == 2. /// </summary> /// <param name="dim"></param> /// <param name="tag"></param> /// <param name="val"></param> public static void SetSizeFromBoundary(int dim, int tag, int val) { IWrap.GmshModelGeoMeshSetSizeFromBoundary(dim, tag, val, ref _ierr); }
/// <summary> /// Add a surface filling the curve loops in `wireTags'. /// Currently only a single curve loop is supported; /// This curve loop should be composed by 3 or 4 curves only. /// Return the tag of the surface. /// </summary> /// <param name="wireTag"> The tag of the closed curve loop. </param> /// <param name="sphereCenterTag"></param> /// <param name="tag"> If `tag' is positive, set the tag explicitly; otherwise a new tag is selected automatically. </param> /// <returns></returns> public static int AddSurfaceFilling(int wireTag, int sphereCenterTag = -1, int tag = -1) { return(IWrap.GmshModelGeoAddSurfaceFilling(new int[] { wireTag }, 1, tag, sphereCenterTag, 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> /// Add a surface loop (a closed shell) formed by `surfaceTags'. /// Return the tag of the shell. /// </summary> /// <param name="surfaceTags"> Tag of the surfaces. </param> /// <param name="tag"> If `tag' is positive, set the tag explicitly; otherwise a new tag is selected automatically. </param> /// <returns></returns> public static int AddSurfaceLoop(int[] surfaceTags, int tag = -1) { return(IWrap.GmshModelGeoAddSurfaceLoop(surfaceTags, surfaceTags.LongLength, tag, ref _ierr)); }
/// <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> /// Add a volume (a region) defined by one or more shells `shellTags'. /// Return the tag of the volume. /// </summary> /// <param name="shellTags"> The first surface loop defines the exterior boundary; additional surface loop define holes. </param> /// <param name="tag"> If `tag' is positive, set the tag explicitly; otherwise a new tag is selected automatically. </param> /// <returns></returns> public static int AddVolume(int[] shellTags, int tag = -1) { return(IWrap.GmshModelGeoAddVolume(shellTags, shellTags.LongLength, tag, 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> /// Set a transfinite meshing constraint on the curve `tag', with `numNodes' nodes distributed according to `meshType' and `coef'. /// Currently supported types are "Progression" (geometrical progression with power `coef') and "Bump" (refinement toward both extremities of the curve). /// </summary> /// <param name="tag"></param> /// <param name="nPoints"></param> /// <param name="meshType"></param> /// <param name="coef"></param> public static void SetTransfiniteCurve(int tag, int nPoints, string meshType, double coef) { IWrap.GmshModelGeoMeshSetTransfiniteCurve(tag, nPoints, meshType, coef, 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> /// Set a transfinite meshing constraint on the surface `tag'. /// </summary> /// <param name="tag"></param> /// <param name="arrangement"> `arrangement' describes the arrangement of the triangles when the surface is not flagged as recombined: /// currently supported values are "Left", "Right", "AlternateLeft" and "AlternateRight" </param> /// <param name="cornerTags"> `cornerTags' can be used to specify the(3 or 4) corners of the transfinite interpolation explicitly; /// specifying the corners explicitly is mandatory if the surface has more that 3 or 4 points on its boundary.; </param> public static void SetTransfiniteSurface(int tag, string arrangement, int[] cornerTags) { IWrap.GmshModelGeoMeshSetTransfiniteSurface(tag, arrangement, cornerTags, cornerTags.LongLength, ref _ierr); }
/// <summary> /// Selects the cell. /// </summary> /// <param name="item">The item.</param> /// <param name="index">The index.</param> /// <returns>NavigationInfo.</returns> private NavigationInfo SelectCell(IWrap item, int index) { var navigationInfo = new NavigationInfo(); var ic = GetContainerFromItem(item); if (ic != null) navigationInfo = ic.SelectByIndex(index); else navigationInfo.ActionState = MoveStates.Fail; return navigationInfo; }
/// <summary> /// Set a transfinite meshing constraint on the surface `tag'. /// </summary> /// <param name="tag"></param> /// <param name="cornerTags"> `cornerTags' can be used to specify the(6 or 8) corners of the transfinite interpolation explicitly. </param> public static void SetTransfiniteVolume(int tag, int[] cornerTags, ref int ierr) { IWrap.GmshModelGeoMeshSetTransfiniteVolume(tag, cornerTags, cornerTags.LongLength, ref _ierr); }
/// <summary> /// Binds the container to item. /// </summary> /// <param name="container">The container.</param> /// <param name="item">The item.</param> private void BindContainerToItem(SpreadsheetItemContainer container, IWrap item) { SpreadsheetItemContainer ctnr; if (_containersDict.TryGetValue(item, out ctnr)) _containersDict[item] = container; else _containersDict.Add(item, container); }
/// <summary> /// Sets the value binding. /// </summary> /// <param name="item">The item.</param> /// <exception cref="System.ArgumentNullException">item;Item specified does not exist</exception> protected void SetValueBinding(IWrap item) { Binding valueBinding; if (item == null) throw new ArgumentNullException("item", "Item specified does not exist"); if (_column.IsRowIndicator) valueBinding = new Binding("Container.Item.RowNumber"); else if (_column.IsGhost) valueBinding = new Binding(string.Format(CultureInfo.InvariantCulture, "Owner.ParentCell.Container.Item.Data.{0}[{1}]", string.IsNullOrEmpty(_column.PropertyPath) ? _column.PropertyName : _column.PropertyPath, item.Index)) { Mode = BindingMode.TwoWay, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }; else if (item.DataType.IsOfValueOrSimpleObjectType() && !_column.IsGhost) valueBinding = new Binding(string.Format(CultureInfo.InvariantCulture, "Owner.ItemsSource[{0}]", item.Index)) { Mode = BindingMode.TwoWay, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }; else valueBinding = new Binding(string.Format(CultureInfo.InvariantCulture, "Container.Item.Data.{0}", string.IsNullOrEmpty(_column.PropertyPath) ? _column.PropertyName : _column.PropertyPath)) { Mode = BindingMode.TwoWay, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged, NotifyOnValidationError = true, ValidatesOnExceptions = true }; BindingOperations.SetBinding(this, ContainedValueProperty, valueBinding); }