bool delete_all_tracker::currently_deleting_all( const char *user, int perm) { std::string user_name; bool deleting = false; if (is_manager(perm)) user_name = mgr; else user_name = user; pthread_mutex_lock(&this->lock); try { deleting = this->qdel_map[user_name]; } catch (...) { deleting = false; } pthread_mutex_unlock(&this->lock); return(deleting); }
bool PWParameterSet::hasComplexData(hid_t h_file) { int iscomplex=0; if(is_manager()) { ostringstream oss; oss << paramTag << "/complex_coefficients"; HDFAttribIO<int> creader(iscomplex); creader.read(h_file,oss.str().c_str()); } myComm->bcast(iscomplex); return iscomplex; }
void PWParameterSet::checkVersion(hid_t h) { if(is_manager()) { hid_t dataset=H5Dopen(h,"version"); hid_t datatype=H5Dget_type(dataset); H5T_class_t classtype = H5Tget_class(datatype); H5Tclose(datatype); H5Dclose(dataset); if(classtype == H5T_INTEGER) { HDFAttribIO<TinyVector<int,2> > hdfver(version); hdfver.read(h,"version"); } else if(classtype == H5T_FLOAT) { TinyVector<double,2> vt; HDFAttribIO<TinyVector<double,2> > hdfver(vt); hdfver.read(h,"version"); version[0]=int(vt[0]); version[1]=int(vt[1]); } //else //{ // APP_ABORT("PWParameterSet::checkVersion The type of version is not integer or double."); //} } myComm->bcast(version); app_log() << "\tWavefunction HDF version: " << version[0] << "." << version[1] << endl; if(version[0] == 0) { if(version[1] == 11) { hasSpin=false; paramTag="parameters_0"; basisTag="basis_1"; pwTag="planewaves"; pwMultTag="multipliers"; eigTag="eigenstates_3"; twistTag="twist_"; bandTag="band_"; } else if(version[1] == 10) { pwMultTag="planewaves"; pwTag="0"; } } }
bool PWParameterSet::getEigVectorType(hid_t h) { int rank=0; if(is_manager()) { ostringstream oss; oss << "/"<<eigTag << "/"<<twistTag<<twistIndex << "/"<< bandTag << 0; //if(version[1]==10) if(hasSpin) oss << "/" << spinTag << 0; oss << "/eigenvector"; hsize_t dimTot[4]; hid_t dataset = H5Dopen(h,oss.str().c_str()); hid_t dataspace = H5Dget_space(dataset); rank = H5Sget_simple_extent_ndims(dataspace); int status_n = H5Sget_simple_extent_dims(dataspace, dimTot, NULL); } myComm->bcast(rank); return rank==4; }
void delete_all_tracker::done_deleting_all( const char *user, int perm) { std::string user_name; if (is_manager(perm)) user_name = mgr; else user_name = user; pthread_mutex_lock(&this->lock); try { this->qdel_map[user_name] = false; } catch (...) {} pthread_mutex_unlock(&this->lock); }
bool delete_all_tracker::start_deleting_all_if_possible( const char *user, int perm) { std::string user_name; bool can_start = false; bool deleting; if (is_manager(perm)) user_name = mgr; else user_name = user; pthread_mutex_lock(&this->lock); try { deleting = this->qdel_map[user_name]; } catch (...) { deleting = false; } if (deleting == false) { this->qdel_map[user_name] = true; can_start = true; } pthread_mutex_unlock(&this->lock); return(can_start); }