Assuming for trimeshes you mean static scenery, drop them into a subspace and disable internal collisions for that.
ODE_world=dWorldCreate()
ODE_space=dHashSpaceCreate(0)
ODE_scenery_space=dHashSpaceCreate(ODE_space)
dSetInternalSpaceCollideMode(0)
And create your trimeshes in ODE_scenery_space instead of ODE_space. Create your moving objects in ODE_space so they collide with each other.
ODE_world=dWorldCreate()
ODE_space=dHashSpaceCreate(0)
ODE_scenery_space=dHashSpaceCreate(ODE_space)
dSetInternalSpaceCollideMode(0)
And create your trimeshes in ODE_scenery_space instead of ODE_space. Create your moving objects in ODE_space so they collide with each other.