private void CreateNURBSShells() { #region Knots Vector singleKnotValuesKsi = KnotValueVectorKsi.RemoveDuplicatesFindMultiplicity()[0]; Vector singleKnotValuesHeta = KnotValueVectorHeta.RemoveDuplicatesFindMultiplicity()[0]; var knots = CreateShellKnots(singleKnotValuesKsi, singleKnotValuesHeta); #endregion Knots #region Elements CreateShellElements(singleKnotValuesKsi, singleKnotValuesHeta, knots); #endregion Elements }
private void CreateElements3D(List <Knot> knots) { Vector singlesKnotValuesKsi = KnotValueVectorKsi.RemoveDuplicatesFindMultiplicity()[0]; Vector multiplicityKsi = KnotValueVectorKsi.RemoveDuplicatesFindMultiplicity()[1]; Vector singlesKnotValuesHeta = KnotValueVectorHeta.RemoveDuplicatesFindMultiplicity()[0]; Vector multiplicityHeta = KnotValueVectorHeta.RemoveDuplicatesFindMultiplicity()[1]; Vector singlesKnotValuesZeta = KnotValueVectorZeta.RemoveDuplicatesFindMultiplicity()[0]; Vector multiplicityZeta = KnotValueVectorZeta.RemoveDuplicatesFindMultiplicity()[1]; int numberOfElementsKsi = singlesKnotValuesKsi.Length - 1; int numberOfElementsHeta = singlesKnotValuesHeta.Length - 1; int numberOfElementsZeta = singlesKnotValuesZeta.Length - 1; if (numberOfElementsKsi * numberOfElementsHeta * numberOfElementsZeta == 0) { throw new ArgumentException("Number of Elements should be defined before Element Connectivity"); } for (int i = 0; i < numberOfElementsKsi; i++) { for (int j = 0; j < numberOfElementsHeta; j++) { for (int k = 0; k < numberOfElementsZeta; k++) { IList <Knot> knotsOfElement = new List <Knot> { knots[ i * singlesKnotValuesZeta.Length * singlesKnotValuesHeta.Length + j * singlesKnotValuesZeta.Length + k], knots[ i * singlesKnotValuesZeta.Length * singlesKnotValuesHeta.Length + j * singlesKnotValuesZeta.Length + k + 1], knots[ i * singlesKnotValuesZeta.Length * singlesKnotValuesHeta.Length + (j + 1) * singlesKnotValuesZeta.Length + k], knots[ i * singlesKnotValuesZeta.Length * singlesKnotValuesHeta.Length + (j + 1) * singlesKnotValuesZeta.Length + k + 1], knots[ (i + 1) * singlesKnotValuesZeta.Length * singlesKnotValuesHeta.Length + j * singlesKnotValuesZeta.Length + k], knots[ (i + 1) * singlesKnotValuesZeta.Length * singlesKnotValuesHeta.Length + j * singlesKnotValuesZeta.Length + k + 1], knots[ (i + 1) * singlesKnotValuesZeta.Length * singlesKnotValuesHeta.Length + (j + 1) * singlesKnotValuesZeta.Length + k], knots[ (i + 1) * singlesKnotValuesZeta.Length * singlesKnotValuesHeta.Length + (j + 1) * singlesKnotValuesZeta.Length + k + 1] }; int multiplicityElementKsi = 0; if (multiplicityKsi[i + 1] - this.DegreeKsi > 0) { multiplicityElementKsi = (int)multiplicityKsi[i + 1] - DegreeKsi; } int multiplicityElementHeta = 0; if (multiplicityHeta[j + 1] - this.DegreeHeta > 0) { multiplicityElementHeta = (int)multiplicityHeta[j + 1] - this.DegreeHeta; } int multiplicityElementZeta = 0; if (multiplicityZeta[k + 1] - this.DegreeZeta > 0) { multiplicityElementZeta = (int)multiplicityZeta[k + 1] - this.DegreeZeta; } int nurbsSupportKsi = this.DegreeKsi + 1; int nurbsSupportHeta = this.DegreeHeta + 1; int nurbsSupportZeta = this.DegreeZeta + 1; IList <ControlPoint> elementControlPoints = new List <ControlPoint>(); for (int l = 0; l < nurbsSupportKsi; l++) { for (int m = 0; m < nurbsSupportHeta; m++) { for (int n = 0; n < nurbsSupportZeta; n++) { int controlPointID = (i + multiplicityElementKsi) * NumberOfControlPointsHeta * NumberOfControlPointsZeta + (j + multiplicityElementHeta) * NumberOfControlPointsZeta + (k + multiplicityElementZeta) + l * NumberOfControlPointsHeta * NumberOfControlPointsZeta + m * NumberOfControlPointsZeta + n; elementControlPoints.Add(ControlPoints[controlPointID]); } } } int elementID = i * numberOfElementsHeta * numberOfElementsZeta + j * numberOfElementsZeta + k; Element element = new NurbsElement3D() { ID = elementID, Patch = this, ElementType = new NurbsElement3D() }; element.AddKnots(knotsOfElement); element.AddControlPoints(elementControlPoints.ToList()); Elements.Add(element); } } } }
private void CreateShellElements(Vector singleKnotValuesKsi, Vector singleKnotValuesHeta, List <Knot> knots) { Vector multiplicityKsi = KnotValueVectorKsi.RemoveDuplicatesFindMultiplicity()[1]; Vector multiplicityHeta = KnotValueVectorHeta.RemoveDuplicatesFindMultiplicity()[1]; int numberOfElementsKsi = singleKnotValuesKsi.Length - 1; int numberOfElementsHeta = singleKnotValuesHeta.Length - 1; if (numberOfElementsKsi * numberOfElementsHeta == 0) { throw new ArgumentException("Number of Elements should be defined before Element Connectivity"); } for (int i = 0; i < numberOfElementsKsi; i++) { for (int j = 0; j < numberOfElementsHeta; j++) { IList <Knot> knotsOfElement = new List <Knot> { knots[i * singleKnotValuesHeta.Length + j], knots[i * singleKnotValuesHeta.Length + j + 1], knots[(i + 1) * singleKnotValuesHeta.Length + j], knots[(i + 1) * singleKnotValuesHeta.Length + j + 1] }; int multiplicityElementKsi = 0; if (multiplicityKsi[i + 1] - this.DegreeKsi > 0) { multiplicityElementKsi = (int)multiplicityKsi[i + 1] - this.DegreeKsi; } int multiplicityElementHeta = 0; if (multiplicityHeta[j + 1] - this.DegreeHeta > 0) { multiplicityElementHeta = (int)multiplicityHeta[j + 1] - this.DegreeHeta; } int nurbsSupportKsi = this.DegreeKsi + 1; int nurbsSupportHeta = this.DegreeHeta + 1; IList <ControlPoint> elementControlPoints = new List <ControlPoint>(); for (int k = 0; k < nurbsSupportKsi; k++) { for (int l = 0; l < nurbsSupportHeta; l++) { int controlPointID = (i + multiplicityElementKsi) * this.NumberOfControlPointsHeta + (j + multiplicityElementHeta) + k * this.NumberOfControlPointsHeta + l; elementControlPoints.Add(ControlPoints[controlPointID]); } } int elementID = i * numberOfElementsHeta + j; Element element = new NurbsKirchhoffLoveShellElement() { ID = elementID, Patch = this, ElementType = new NurbsKirchhoffLoveShellElement() }; element.AddKnots(knotsOfElement); element.AddControlPoints(elementControlPoints.ToList <ControlPoint>()); Elements.Add(element); } } }