Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion app/gui/remotefilebrowser/remotefiledialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1232,12 +1232,14 @@ void RemoteFileDialog::setNameFilters(const QStringList &filters)
if (filters.size() > 1) {
QString allSupported;
QRegularExpression rex(R"(\((.*)\))");
int numCombined = 0;
for (auto &filter: filters) {
QRegularExpressionMatch match = rex.match(filter);
if (match.hasMatch()) {
QString glob = match.captured(1);
if (glob == "*")
continue;
++numCombined;
if (allSupported.isEmpty())
allSupported = match.captured(1);
else
Expand All @@ -1246,7 +1248,8 @@ void RemoteFileDialog::setNameFilters(const QStringList &filters)
}
allSupported.prepend(QLatin1String("All Supported ("));
allSupported.append(QLatin1String(")"));
cleanedFilters << allSupported.simplified();
if (numCombined > 1)
cleanedFilters << allSupported.simplified();
}

for (int i = 0; i < numFilters; ++i) {
Expand Down
14 changes: 7 additions & 7 deletions app/gui/uicontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@

namespace gui {

QStringList fileNameFilters{"Vistle Files (*.vsl)", "Python Files (*.py)", "All Files (*)"};

UiController::UiController(int argc, char *argv[], QObject *parent): QObject(parent), m_mainWindow(nullptr)
{
std::string hostname = vistle::hostname();
Expand Down Expand Up @@ -350,7 +352,7 @@ void UiController::loadDataFlowNetworkOnGui()

QString dir = m_currentFile.isEmpty() ? QDir::currentPath() : m_currentFile;
QString filename = QFileDialog::getOpenFileName(m_mainWindow, tr("Open Workflow"), dir,
tr("Vistle files (*.vsl);;Python files (*.py);;All files (*)"));
tr("Vistle Files (*.vsl);;Python Files (*.py);;All Files (*)"));

if (filename.isEmpty())
return;
Expand Down Expand Up @@ -378,8 +380,7 @@ void UiController::loadDataFlowNetworkOnHub()
browser->selectFile(m_currentFile.isEmpty() ? "." : m_currentFile);
browser->setFileMode(RemoteFileDialog::ExistingFile);
browser->setAcceptMode(RemoteFileDialog::AcceptOpen);
QStringList filters{"Vistle files (*.vsl)", "Python files (*.py)", "All files (*)"};
browser->setNameFilters(filters);
browser->setNameFilters(fileNameFilters);
browser->setWindowTitle("Open Workflow");

connect(browser, &QDialog::accepted, [this, browser]() {
Expand Down Expand Up @@ -430,9 +431,9 @@ void UiController::saveDataFlowNetwork(const QString &filename, int hubId)

void UiController::saveDataFlowNetworkOnGui(const QString &filename)
{
QString filters = fileNameFilters.join(";;");
QString newFile = QFileDialog::getSaveFileName(m_mainWindow, tr("Save Workflow"),
filename.isEmpty() ? QDir::currentPath() : filename,
tr("Vistle files (*.vsl);;Python files (*.py);;All files (*)"));
filename.isEmpty() ? QDir::currentPath() : filename, filters);

if (!newFile.isEmpty()) {
saveDataFlowNetwork(newFile, vistle::message::Id::UI);
Expand All @@ -453,8 +454,7 @@ void UiController::saveDataFlowNetworkOnHub(const QString &pathname)
browser->selectFile(pathname);
browser->setFileMode(RemoteFileDialog::AnyFile);
browser->setAcceptMode(RemoteFileDialog::AcceptSave);
QStringList filters{"Vistle files (*.vsl)", "Python files (*.py)", "All files (*)"};
browser->setNameFilters(filters);
browser->setNameFilters(fileNameFilters);
browser->setWindowTitle("Save Workflow");

connect(browser, &QDialog::accepted, [this, browser]() {
Expand Down
2 changes: 1 addition & 1 deletion lib/vistle/vtk/vtktovistle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ bool subCellCoordinatesFromId(int &i, int &j, int &k, int subId, const int order
std::array<Index, UnstructuredGrid::NumVertices[UnstructuredGrid::HEXAHEDRON]> approximateSubHex(int subId,
const int order[])
{
int i, j, k;
int i = 0, j = 0, k = 0;
if (!subCellCoordinatesFromId(i, j, k, subId, order)) {
std::cerr << "subCellCoordinatesFromId failed" << std::endl;
}
Expand Down
18 changes: 9 additions & 9 deletions module/read/ReadCovise/ReadCovise.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -476,9 +476,9 @@ Object::ptr ReadCovise::readSTRGRD(Token &token, const int port, int fd, const b
Scalar *x = str->x().data(), *y = str->y().data(), *z = str->z().data();
size_t idx = 0;
const Index vdim[3] = {static_cast<Index>(dim[0]), static_cast<Index>(dim[1]), static_cast<Index>(dim[2])};
for (Index k = 0; k < dim[0]; ++k) {
for (Index j = 0; j < dim[1]; ++j) {
for (Index i = 0; i < dim[2]; ++i) {
for (Index k = 0; k < vdim[0]; ++k) {
for (Index j = 0; j < vdim[1]; ++j) {
for (Index i = 0; i < vdim[2]; ++i) {
auto vidx = StructuredGrid::vertexIndex(k, j, i, vdim);
x[vidx] = _x[idx];
y[vidx] = _y[idx];
Expand Down Expand Up @@ -677,9 +677,9 @@ Object::ptr ReadCovise::readSTRSDT(Token &token, const int port, int fd, const b
auto x = array->x().data();
const Index vdim[3] = {static_cast<Index>(sx), static_cast<Index>(sy), static_cast<Index>(sz)};
Index idx = 0;
for (Index k = 0; k < sx; ++k) {
for (Index j = 0; j < sy; ++j) {
for (Index i = 0; i < sz; ++i) {
for (Index k = 0; k < vdim[0]; ++k) {
for (Index j = 0; j < vdim[1]; ++j) {
for (Index i = 0; i < vdim[2]; ++i) {
auto vidx = StructuredGrid::vertexIndex(k, j, i, vdim);
x[vidx] = _x[idx];
++idx;
Expand Down Expand Up @@ -716,9 +716,9 @@ Object::ptr ReadCovise::readSTRVDT(Token &token, const int port, int fd, const b
auto z = array->z().data();
const Index vdim[3] = {static_cast<Index>(sx), static_cast<Index>(sy), static_cast<Index>(sz)};
Index idx = 0;
for (Index k = 0; k < sx; ++k) {
for (Index j = 0; j < sy; ++j) {
for (Index i = 0; i < sz; ++i) {
for (Index k = 0; k < vdim[0]; ++k) {
for (Index j = 0; j < vdim[1]; ++j) {
for (Index i = 0; i < vdim[2]; ++i) {
auto vidx = StructuredGrid::vertexIndex(k, j, i, vdim);
x[vidx] = _x[idx];
y[vidx] = _y[idx];
Expand Down
11 changes: 8 additions & 3 deletions module/read/ReadDuisburg/ReadDuisburg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,14 @@ bool ReadDuisburg::examine(const vistle::Parameter *param)
if (!param || param == m_gridFile) {
LOCK_NETCDF(comm());
//extract number of timesteps from file
NcmpiFile ncFile(comm(), m_gridFile->getValue().c_str(), NcmpiFile::read);
const NcmpiDim timesDim = ncFile.getDim("t");
size_t nTimes = timesDim.getSize();
size_t nTimes = 0;
try {
NcmpiFile ncFile(comm(), m_gridFile->getValue().c_str(), NcmpiFile::read);
const NcmpiDim timesDim = ncFile.getDim("t");
nTimes = timesDim.getSize();
} catch (std::exception &ex) {
sendError("Error opening file: " + std::string(ex.what()));
}
UNLOCK_NETCDF(comm());

setTimesteps(nTimes);
Expand Down