 	ANCF_VelSlopesD.clear();
 	ANCF_Beam_LengthD.clear();
 	ANCF_ReferenceArrayNodesOnBeamsD.clear();
+
+	ANCF_NumMarkers_Per_BeamD.clear();
+	ANCF_NumMarkers_Per_Beam_CumulD.clear();
+	ANCF_NumNodesMultMarkers_Per_BeamD.clear();
+	ANCF_NumNodesMultMarkers_Per_Beam_CumulD.clear();
+
+
 
 	posRigidCumulativeD.clear();
 	velMassRigidD.clear();

#include <thrust/reduce.h>
#include <thrust/host_vector.h>
#include <thrust/device_vector.h>
#include "collideSphereSphere.cuh"
#include "SDKCollisionSystem.cuh"
#include "printToFile.cuh"

	thrust::device_vector<real3> ANCF_VelSlopesD = ANCF_VelSlopes;
	thrust::device_vector<real_> ANCF_Beam_LengthD = ANCF_Beam_Length;
	thrust::device_vector<int2> ANCF_ReferenceArrayNodesOnBeamsD = ANCF_ReferenceArrayNodesOnBeams;

	//*******************
	thrust::device_vector<int> ANCF_NumMarkers_Per_BeamD(numFlexBodies);
	thrust::device_vector<int> ANCF_NumMarkers_Per_Beam_CumulD(numFlexBodies);
	thrust::device_vector<int> ANCF_NumNodesMultMarkers_Per_BeamD(numFlexBodies);
	thrust::device_vector<int> ANCF_NumNodesMultMarkers_Per_Beam_CumulD(numFlexBodies);

	thrust::device_vector<int> dummySum(flexIdentifierD.size());
	thrust::device_vector<int> dummyIdentifier(0);
	thrust::fill(dummySum.begin(), dummySum.end(), 1);
	(void) thrust::reduce_by_key(flexIdentifierD.begin(), flexIdentifierD.end(), dummySum.begin(), dummyIdentifier.begin(), ANCF_NumMarkers_Per_BeamD.begin());
	thrust::exclusive_scan(ANCF_NumMarkers_Per_BeamD.begin(), ANCF_NumMarkers_Per_BeamD.end(), ANCF_NumMarkers_Per_Beam_CumulD());
	dummySum.clear();
	dummyIdentifier.clear();
	//*******************

	Calc_NumNodesMultMarkers_Per_Beam(ANCF_NumNodesMultMarkers_Per_BeamD, ANCF_NumMarkers_Per_BeamD, ANCF_ReferenceArrayNodesOnBeams, numFlexBodies);
	thrust::exclusive_scan(ANCF_NumNodesMultMarkers_Per_BeamD.begin(), ANCF_NumNodesMultMarkers_Per_BeamD.end(), ANCF_NumNodesMultMarkers_Per_Beam_CumulD());



	thrust::device_vector<real3> flexSPH_MeshPos_LRF_D(numFlex_SphMarkers);
