 
 #include <cstdio>
 
-//#####################################################################################
+#define flexGPU true
+#if flexGPU
+#define flexParamsD flexParamsD
+#define dTD dTD
+#define numFlexBodiesD numFlexBodiesD
+#define GQD GQD
+#else
+#define flexParamsD flexParamsH
+#define dTD dTH
+#define numFlexBodiesD numFlexBodiesH
+#define GQD GQH
+#endif
+
 __constant__ ANCF_Params flexParamsD;
 __constant__ real_ dTD;
 __constant__ int numFlexBodiesD;
 __constant__ GaussQuadrature GQD;
+
+ANCF_Params flexParamsH;
+real_ dTH;
+int numFlexBodiesH;
+GaussQuadrature GQH;
 
 //------------------------------------------------------------------------------
 __device__ __host__ inline void Zero12(Elem12 & m) {

			isCantilever);
}
//------------------------------------------------------------------------------
__global__ void IntegrateInTimeD(
		real3 * ANCF_NodesD2,
		real3 * ANCF_SlopesD2,
		real3 * ANCF_NodesVelD2,

		nodesPortionAdjusted2.x = nodesPortionAdjusted2.x + 1;
	}

	int numNodesAdjusted = nodesPortionAdjusted2.y - nodesPortionAdjusted2.x;
	for (int j = 0; j < numNodesAdjusted; j++) {
		int nodeIdx = nodesPortionAdjusted2.x + j;
		ANCF_NodesD2[nodeIdx] += dTD * ANCF_NodesVelD[nodeIdx];
		ANCF_SlopesD2[nodeIdx] += dTD * ANCF_SlopesVelD[nodeIdx];

		ANCF_NodesVelD2[nodeIdx] += dTD * ANCF_NodesAccD[nodeIdx];
		ANCF_SlopesVelD2[nodeIdx] += dTD * ANCF_SlopesAccD[nodeIdx];
	}
}
//------------------------------------------------------------------------------
__global__ void IntegrateInTimeD(
		real3 * ANCF_NodesD2,
		real3 * ANCF_SlopesD2,
		real3 * ANCF_NodesVelD2,
		real3 * ANCF_SlopesVelD2,

		const real3 * ANCF_NodesVelD,
		const real3 * ANCF_SlopesVelD,
		const real3 * ANCF_NodesAccD,
		const real3 * ANCF_SlopesAccD,

		const int2 * ANCF_ReferenceArrayNodesOnBeamsD,
		const bool * ANCF_IsCantileverD
	)
{
	uint i = blockIdx.x * blockDim.x + threadIdx.x;
	if (i >= numFlexBodiesD) return;

	IntegrateInTimeKernel(
			ANCF_NodesD2, ANCF_SlopesD2, ANCF_NodesVelD2, ANCF_SlopesVelD2,
			ANCF_NodesVelD, ANCF_SlopesVelD, ANCF_NodesAccD, ANCF_SlopesAccD,
			ANCF_ReferenceArrayNodesOnBeamsD, ANCF_IsCantileverD, i	);

}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
