ISAAR.MSolve.IGA/Postprocessing/ParaviewNurbsShells.cs
/// <summary>
/// Creates Paraview File of the NURBS Shells geometry.
/// </summary>
Creates Paraview File of the NURBS Shells geometry.
Creates Paraview File of the NURBS Shells geometry .
public void CreateParaview2DFile()
		{
			var uniqueKnotsKsi = _model.PatchesDictionary[0].KnotValueVectorKsi.RemoveDuplicatesFindMultiplicity();
			var uniqueKnotsHeta = _model.PatchesDictionary[0].KnotValueVectorHeta.RemoveDuplicatesFindMultiplicity();
			var numberOfKnotsKsi = uniqueKnotsKsi[0].Length;
			var numberOfKnotsHeta = uniqueKnotsHeta[0].Length;
			var knots = new double[numberOfKnotsKsi * numberOfKnotsHeta, 3];
			var count = 0;
			var patch = _model.PatchesDictionary[0];
			var projectiveControlPoints = CalculateProjectiveControlPoints();
			for (var knotKsiIndex = 0; knotKsiIndex < numberOfKnotsKsi; knotKsiIndex++)
			{
				for (var knotHetaIndex = 0; knotHetaIndex < numberOfKnotsHeta; knotHetaIndex++)
				{
					var hetaCoordinate = uniqueKnotsHeta[0][knotHetaIndex];
					var ksiCoordinate = uniqueKnotsKsi[0][knotKsiIndex];
					var point3D = ParaviewNurbs2D.SurfacePoint2D(patch.NumberOfControlPointsKsi - 1, patch.DegreeKsi,
						patch.KnotValueVectorKsi, patch.NumberOfControlPointsHeta - 1, patch.DegreeHeta,
						patch.KnotValueVectorHeta, projectiveControlPoints, ksiCoordinate, hetaCoordinate);
					knots[count, 0] = point3D[0] / point3D[3];
					knots[count, 1] = point3D[1] / point3D[3];
					knots[count, 2] = point3D[2] / point3D[3];
                    count++;
                }
			}
			var incrementKsi = numberOfKnotsHeta;
			var incrementHeta = 1;
			var nodePattern = new int[] { 0, incrementKsi, incrementKsi + 1, 1 };
			var elementConnectivity = CreateElement2DConnectivity(nodePattern, uniqueKnotsKsi[0].Length - 1,
				uniqueKnotsHeta[0].Length - 1, incrementKsi, incrementHeta);
			var knotDisplacements = new double[knots.GetLength(0), 3];
			foreach (var element in _model.Elements)
			{
				var localDisplacements = Matrix.CreateZero(element.ControlPointsDictionary.Count, 3);
				var counterCP = 0;
				foreach (var controlPoint in element.ControlPoints)
				{
					localDisplacements[counterCP, 0] =
						(!_model.GlobalDofOrdering.GlobalFreeDofs.Contains(controlPoint, StructuralDof.TranslationX))
							? 0.0
							: _solution[_model.GlobalDofOrdering.GlobalFreeDofs[controlPoint, StructuralDof.TranslationX]];
					localDisplacements[counterCP, 1] =
						(!_model.GlobalDofOrdering.GlobalFreeDofs.Contains(controlPoint, StructuralDof.TranslationY))
							? 0.0
							: _solution[_model.GlobalDofOrdering.GlobalFreeDofs[controlPoint, StructuralDof.TranslationY]];
					localDisplacements[counterCP, 2] =
						(!_model.GlobalDofOrdering.GlobalFreeDofs.Contains(controlPoint, StructuralDof.TranslationZ))
							? 0.0
							: _solution[_model.GlobalDofOrdering.GlobalFreeDofs[controlPoint, StructuralDof.TranslationZ]];
                    counterCP++;
                }
				var elementKnotDisplacements = element.ElementType.CalculateDisplacementsForPostProcessing(element, localDisplacements);
				for (int i = 0; i < elementConnectivity.GetLength(1); i++)
				{
					var knotConnectivity = elementConnectivity[element.ID, i];
					knotDisplacements[knotConnectivity, 0] = elementKnotDisplacements[i, 0];
					knotDisplacements[knotConnectivity, 1] = elementKnotDisplacements[i, 1];
					knotDisplacements[knotConnectivity, 2] = elementKnotDisplacements[i, 2];
				}
			}
			Write2DNurbsFile(knots, elementConnectivity, "Quad4", knotDisplacements);
		}
public void CreateParaview2DFile ( ) { var uniqueKnotsKsi = _model . PatchesDictionary [ 0 ] . KnotValueVectorKsi . RemoveDuplicatesFindMultiplicity ( ) ; var uniqueKnotsHeta = _model . PatchesDictionary [ 0 ] . KnotValueVectorHeta . RemoveDuplicatesFindMultiplicity ( ) ; var numberOfKnotsKsi = uniqueKnotsKsi [ 0 ] . Length ; var numberOfKnotsHeta = uniqueKnotsHeta [ 0 ] . Length ; var knots = new double [ numberOfKnotsKsi * numberOfKnotsHeta , 3 ] ; var count = 0 ; var patch = _model . PatchesDictionary [ 0 ] ; var projectiveControlPoints = CalculateProjectiveControlPoints ( ) ; for ( var knotKsiIndex = 0 ; knotKsiIndex < numberOfKnotsKsi ; knotKsiIndex ++ ) { for ( var knotHetaIndex = 0 ; knotHetaIndex < numberOfKnotsHeta ; knotHetaIndex ++ ) { var hetaCoordinate = uniqueKnotsHeta [ 0 ] [ knotHetaIndex ] ; var ksiCoordinate = uniqueKnotsKsi [ 0 ] [ knotKsiIndex ] ; var point3D = ParaviewNurbs2D . SurfacePoint2D ( patch . NumberOfControlPointsKsi - 1 , patch . DegreeKsi , patch . KnotValueVectorKsi , patch . NumberOfControlPointsHeta - 1 , patch . DegreeHeta , patch . KnotValueVectorHeta , projectiveControlPoints , ksiCoordinate , hetaCoordinate ) ; knots [ count , 0 ] = point3D [ 0 ] / point3D [ 3 ] ; knots [ count , 1 ] = point3D [ 1 ] / point3D [ 3 ] ; knots [ count , 2 ] = point3D [ 2 ] / point3D [ 3 ] ; count ++ ; } } var incrementKsi = numberOfKnotsHeta ; var incrementHeta = 1 ; var nodePattern = new int [ ] { 0 , incrementKsi , incrementKsi + 1 , 1 } ; var elementConnectivity = CreateElement2DConnectivity ( nodePattern , uniqueKnotsKsi [ 0 ] . Length - 1 , uniqueKnotsHeta [ 0 ] . Length - 1 , incrementKsi , incrementHeta ) ; var knotDisplacements = new double [ knots . GetLength ( 0 ) , 3 ] ; foreach ( var element in _model . Elements ) { var localDisplacements = Matrix . CreateZero ( element . ControlPointsDictionary . Count , 3 ) ; var counterCP = 0 ; foreach ( var controlPoint in element . ControlPoints ) { localDisplacements [ counterCP , 0 ] = ( ! _model . GlobalDofOrdering . GlobalFreeDofs . Contains ( controlPoint , StructuralDof . TranslationX ) ) ? 0.0 : _solution [ _model . GlobalDofOrdering . GlobalFreeDofs [ controlPoint , StructuralDof . TranslationX ] ] ; localDisplacements [ counterCP , 1 ] = ( ! _model . GlobalDofOrdering . GlobalFreeDofs . Contains ( controlPoint , StructuralDof . TranslationY ) ) ? 0.0 : _solution [ _model . GlobalDofOrdering . GlobalFreeDofs [ controlPoint , StructuralDof . TranslationY ] ] ; localDisplacements [ counterCP , 2 ] = ( ! _model . GlobalDofOrdering . GlobalFreeDofs . Contains ( controlPoint , StructuralDof . TranslationZ ) ) ? 0.0 : _solution [ _model . GlobalDofOrdering . GlobalFreeDofs [ controlPoint , StructuralDof . TranslationZ ] ] ; counterCP ++ ; } var elementKnotDisplacements = element . ElementType . CalculateDisplacementsForPostProcessing ( element , localDisplacements ) ; for ( int i = 0 ; i < elementConnectivity . GetLength ( 1 ) ; i ++ ) { var knotConnectivity = elementConnectivity [ element . ID , i ] ; knotDisplacements [ knotConnectivity , 0 ] = elementKnotDisplacements [ i , 0 ] ; knotDisplacements [ knotConnectivity , 1 ] = elementKnotDisplacements [ i , 1 ] ; knotDisplacements [ knotConnectivity , 2 ] = elementKnotDisplacements [ i , 2 ] ; } } Write2DNurbsFile ( knots , elementConnectivity , " " , knotDisplacements ) ; }
Creates Paraview File of the NURBS Shells geometry.
Creates Paraview File of the NURBS Shells geometry .