Skip to content

Small issues in the code and their resolutions #4

@mmmovania

Description

@mmmovania

Thanks for sharing your work. There were some issues in the latest code which does not work for me on Windows 10 x64 PC on MS VisualStudio 2019.
Issue 1) The smf files are not listed in the combobox.
Resolution: Change line 33 in simulation_controller.cpp from
std::filesystem::directory_iterator iter(std::filesystem::current_path()); to
std::filesystem::recursive_directory_iterator iter(std::filesystem::current_path());

By default, the directory iterator only searches in the current directory ignoring the sub-folders. For searching in the sub-folders you need to use the recursive_directory_iterator. Your .smf meshes are inside the meshes sub-folder so this recursive directory iterator should be used.

Issue 2) The smf files are not loaded when you click on the combobox.
Resolution: Change the function SimulationController::readGeometryFromFile to include the meshes sub-folder like this

bool SimulationController::readGeometryFromFile(AlignedVector::AlignedVector<glm::vec3>& coords, AlignedVector::AlignedVector<glm::uvec3>& indices, const std::string& file_path) const
{
   std::ifstream stream;
   std::filesystem::path fullpath = std::filesystem::current_path() / "meshes" / file_path;
   stream.open(fullpath.c_str());
   if (!stream.is_open()) 
   {
	return false;
   }
   //...rest of the code 

Making these changes you should be able to replicate the results as shown in the demo video in the readme. I had a hard time figuring out the issues so I thought of sharing these here for others in case they are stuck like I was.

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions