Source/FemPhysicsMatrixFree.cpp
void FemPhysicsMatrixFree::SubStep(real h)
	{
		for (uint32 i = 0; i < mForces.size(); i++)
			mForces[i].SetZero();
		ElasticEnergy::ComputeForces(this, mForces);

		ComputeSpringForces(mForces);

		// integrate node velocities and positions using Symplectic Euler
		for (size_t i = 0; i < nodes.size(); i++)
		{
			if (nodes[i].invMass == 0)
				continue;
			nodes[i].vel += (h * nodes[i].invMass) * mForces[i] + h * mGravity;
			nodes[i].pos += h * nodes[i].vel;
		}
	}
// simplest way of doing time dependent FEM - explicit integration of the discretized system
simplest way of doing time dependent FEM - explicit integration of the discretized system
simplest way of doing time dependent FEM - explicit integration of the discretized system
void FemPhysicsMatrixFree::SubStep(real h)
	{
		for (uint32 i = 0; i < mForces.size(); i++)
			mForces[i].SetZero();
		ElasticEnergy::ComputeForces(this, mForces);
		ComputeSpringForces(mForces);
		for (size_t i = 0; i < nodes.size(); i++)
		{
			if (nodes[i].invMass == 0)
				continue;
			nodes[i].vel += (h * nodes[i].invMass) * mForces[i] + h * mGravity;
			nodes[i].pos += h * nodes[i].vel;
		}
	}
void FemPhysicsMatrixFree :: SubStep ( real h ) { for ( uint32 i = 0 ; i < mForces . size ( ) ; i ++ ) mForces [ i ] . SetZero ( ) ; ElasticEnergy :: ComputeForces ( this , mForces ) ; ComputeSpringForces ( mForces ) ; for ( size_t i = 0 ; i < nodes . size ( ) ; i ++ ) { if ( nodes [ i ] . invMass == 0 ) continue ; nodes [ i ] . vel += ( h * nodes [ i ] . invMass ) * mForces [ i ] + h * mGravity ; nodes [ i ] . pos += h * nodes [ i ] . vel ; } }
simplest way of doing time dependent FEM - explicit integration of the discretized system
simplest way of doing time dependent FEM - explicit integration of the discretized system
// integrate node velocities and positions using Symplectic Euler