int __cdecl _tmain (int argc, TCHAR *argv[]) { HRESULT result = ProcessArgs(argc, argv); if (FAILED(result)) return result; UseImage(QueryContinuously); return S_OK; }
void BaseADMImageItem::BaseDraw(IADMDrawer drawer) { ASBoolean needNormalDraw = true; if (UseImage()) { IADMRect boundsRect; drawer.GetBoundsRect(boundsRect); if (fImage && (fImage.GetWidth() != boundsRect.Width() || fImage.GetHeight() != boundsRect.Height())) { sADMImage->Destroy(fImage); fImage = NULL; } if (!fImage && boundsRect.Width() != 0 && boundsRect.Height() != 0) fImage = sADMImage->CreateOffscreen(boundsRect.Width(), boundsRect.Height(), 0); if (fImage) { IADMDrawer imageDrawer = fImage.BeginADMDrawer(); if (imageDrawer) { // Make sure we are using the same background color as original drawer imageDrawer.SetUsePaletteBGColor( drawer.GetUsePaletteBGColor() ); imageDrawer.ClearRect(boundsRect); Draw(imageDrawer); fImage.EndADMDrawer(); needNormalDraw = false; } IADMPoint point(0, 0); drawer.DrawADMImage(fImage, point); } } if (needNormalDraw) Draw(drawer); }
// Action_Distance::init() Action::RetType Action_Distance::Init(ArgList& actionArgs, TopologyList* PFL, FrameList* FL, DataSetList* DSL, DataFileList* DFL, int debugIn) { // Get Keywords InitImaging( !(actionArgs.hasKey("noimage")) ); useMass_ = !(actionArgs.hasKey("geom")); DataFile* outfile = DFL->AddDataFile( actionArgs.GetStringKey("out"), actionArgs ); DataSet::scalarType stype = DataSet::UNDEFINED; std::string stypename = actionArgs.GetStringKey("type"); if ( stypename == "hbond" ) stype = DataSet::HBOND; else if (stypename == "noe" ) stype = DataSet::NOE; // TODO: Grab bound and boundh // Get Masks std::string mask1 = actionArgs.GetMaskNext(); std::string mask2 = actionArgs.GetMaskNext(); if (mask1.empty() || mask2.empty()) { mprinterr("Error: distance: Requires 2 masks\n"); return Action::ERR; } Mask1_.SetMaskString(mask1); Mask2_.SetMaskString(mask2); // Dataset to store distances dist_ = DSL->AddSet(DataSet::DOUBLE, actionArgs.GetStringNext(), "Dis"); if (dist_==0) return Action::ERR; dist_->SetScalar( DataSet::M_DISTANCE, stype ); // Add dataset to data file if (outfile != 0) outfile->AddSet( dist_ ); mprintf(" DISTANCE: %s to %s",Mask1_.MaskString(), Mask2_.MaskString()); if (!UseImage()) mprintf(", non-imaged"); if (useMass_) mprintf(", center of mass"); else mprintf(", geometric center"); mprintf(".\n"); return Action::OK; }
Action::RetType Action_DNAionTracker::Init(ArgList& actionArgs, TopologyList* PFL, DataSetList* DSL, DataFileList* DFL, int debugIn) { // Get keywords DataFile* outfile = DFL->AddDataFile(actionArgs.GetStringKey("out"), actionArgs); poffset_ = actionArgs.getKeyDouble("poffset", 5.0); InitImaging( !actionArgs.hasKey("noimage") ); if (actionArgs.hasKey("shortest")) bintype_ = SHORTEST; else if (actionArgs.hasKey("counttopcone")) bintype_ = TOPCONE; else if (actionArgs.hasKey("countbottomcone")) bintype_ = BOTTOMCONE; else if (actionArgs.hasKey("count")) bintype_ = COUNT; // Get masks - 4 must be specified std::string m1 = actionArgs.GetMaskNext(); std::string m2 = actionArgs.GetMaskNext(); std::string m3 = actionArgs.GetMaskNext(); std::string m4 = actionArgs.GetMaskNext(); if (m1.empty() || m2.empty() || m3.empty() || m4.empty()) { mprinterr("Error: dnaiontracker requires 4 masks.\n"); return Action::ERR; } p1_.SetMaskString(m1); p2_.SetMaskString(m2); base_.SetMaskString(m3); ions_.SetMaskString(m4); // Add dataset to dataset list (and datafile list if filename specified) distance_ = DSL->AddSet(DataSet::DOUBLE, MetaData(actionArgs.GetStringNext(), MetaData::M_DISTANCE), "DNAion"); if (distance_==0) return Action::ERR; if (outfile != 0) outfile->AddDataSet( distance_ ); // INFO mprintf(" DNAIONTRACKER: Data representing the "); switch (bintype_) { case COUNT : mprintf("count within the cone will be\n"); break; case SHORTEST: mprintf("shortest distance to a phosphate or base centroid will be\n"); break; case TOPCONE: mprintf("count in the top half of the cone (and sort-of bound) will be\n"); break; case BOTTOMCONE: mprintf("count in the bottom half of the cone will be\n"); break; } mprintf(" saved to array named %s\n", distance_->legend()); mprintf(" Perpendicular offset for cone is %5.2f angstroms\n", poffset_); if (!UseImage()) mprintf(" Imaging has been disabled\n"); mprintf("\tPhosphate1 Mask [%s]\n", p1_.MaskString()); mprintf("\tPhosphate2 Mask [%s]\n", p2_.MaskString()); mprintf("\tBase Mask [%s]\n", base_.MaskString()); mprintf("\tIons Mask [%s]\n", ions_.MaskString()); if (outfile != 0) mprintf("\tData will be printed to a file named %s\n", outfile->DataFilename().full()); return Action::OK; }
// Action_Watershell::init() Action::RetType Action_Watershell::Init(ArgList& actionArgs, ActionInit& init, int debugIn) { InitImaging( !actionArgs.hasKey("noimage") ); // Get keywords std::string filename = actionArgs.GetStringKey("out"); lowerCutoff_ = actionArgs.getKeyDouble("lower", 3.4); upperCutoff_ = actionArgs.getKeyDouble("upper", 5.0); // Get solute mask std::string maskexpr = actionArgs.GetMaskNext(); if (maskexpr.empty()) { mprinterr("Error: Solute mask must be specified.\n"); return Action::ERR; } soluteMask_.SetMaskString( maskexpr ); // Check for solvent mask solventmaskexpr_ = actionArgs.GetMaskNext(); // For backwards compat., if no 'out' assume next string is if (filename.empty() && actionArgs.Nargs() > 2 && !actionArgs.Marked(2)) filename = actionArgs.GetStringNext(); DataFile* outfile = init.DFL().AddDataFile( filename, actionArgs ); // Set up datasets std::string dsname = actionArgs.GetStringNext(); if (dsname.empty()) dsname = init.DSL().GenerateDefaultName("WS"); lower_ = init.DSL().AddSet(DataSet::INTEGER, MetaData(dsname, "lower")); upper_ = init.DSL().AddSet(DataSet::INTEGER, MetaData(dsname, "upper")); if (lower_ == 0 || upper_ == 0) return Action::ERR; if (outfile != 0) { outfile->AddDataSet(lower_); outfile->AddDataSet(upper_); } # ifdef _OPENMP // Determine number of parallel threads #pragma omp parallel { if (omp_get_thread_num()==0) numthreads_ = omp_get_num_threads(); } # endif mprintf(" WATERSHELL:"); if (outfile != 0) mprintf(" Output to %s", outfile->DataFilename().full()); mprintf("\n"); if (!UseImage()) mprintf("\tImaging is disabled.\n"); mprintf("\tThe first shell will contain water < %.3f angstroms from\n", lowerCutoff_); mprintf("\t the solute; the second shell < %.3f angstroms...\n", upperCutoff_); mprintf("\tSolute atoms will be specified by [%s]\n",soluteMask_.MaskString()); if (!solventmaskexpr_.empty()) { mprintf("\tSolvent atoms will be specified by [%s]\n", solventmaskexpr_.c_str()); solventMask_.SetMaskString( solventmaskexpr_ ); } if (numthreads_ > 1) mprintf("\tParallelizing calculation with %i threads.\n", numthreads_); mprintf("\t# waters in 'lower' shell stored in set '%s'\n", lower_->legend()); mprintf("\t# waters in 'upper' shell stored in set '%s'\n", upper_->legend()); // Pre-square upper and lower cutoffs lowerCutoff_ *= lowerCutoff_; upperCutoff_ *= upperCutoff_; return Action::OK; }