c++ version of dag_get_materials.py >> starting