Esempio n. 1
0
void FileUtils::getFilesFromDir(const std::string& dirPath, std::vector<std::string>& files, bool includeChild)const
{
    std::string finallyPath = dirPath;
    if (*(finallyPath.end() - 1) != '/' && *(finallyPath.end() - 1) != '\\')
    {
        finallyPath.append("/");
    }
    DIR* dir =opendir(finallyPath.c_str());
    if (!dir) return;
    dirent* entry = readdir(dir);
    while (entry)
    {
        if (strcmp(entry->d_name, ".") == 0 || strcmp(entry->d_name, "..") == 0)
        {
            entry = readdir(dir);
            continue;
        }
            
        if (entry->d_type == DT_REG)
        {
            files.push_back(finallyPath + entry->d_name);
        }
        if (entry->d_type == DT_DIR && includeChild)
        {
            std::string strChildDir = finallyPath + entry->d_name;
            getFilesFromDir(strChildDir, files, includeChild);
        }

        entry = readdir(dir);
    }
    closedir(dir);
}
Esempio n. 2
0
int main(int argc, char**argv) {

	parseOptions(argc, argv);

	std::vector<std::string> solutions;
	std::string dir(globalArgs.inDirName);

	getFilesFromDir(dir, solutions, "V_t_");

	if(globalArgs.inType == ALG) {
		if(globalArgs.dim == D2) {
			convertAlgToVTKHash(solutions, globalArgs.sideLenght);
		}
		else if(globalArgs.dim == D3) {
			convertAlgToVTKHash3D(solutions, globalArgs.sideLenght);
		}
	}
	else {
		convertPetscToVTKHash(solutions, globalArgs.meshName);
	}
}