static void doFile (const char * moduleName) { assert (moduleName); printBeginGuard(moduleName, cout); printCopyright (cout); cout << endl; cout << "#include \"AAFTypes.h\"" << endl; cout << endl; cout << "// AAF extensible enumeration member UIDs." << endl << "//" << endl << endl; size_t i = 0; for (i = 0; i < sizeof(members)/sizeof(members[0]); i++) { if (members[i].kind == 1) { if ((i > 0) && (members[i-1].kind == 1)) { cout << "// None currently defined" << endl; cout << endl; } cout << "// Members of " << members[i].name << endl; cout << "//" << endl; } else if (members[i].kind == 2) { printDefinition("const aafUID_t", prefix, members[i].name, 0, members[i].identifier, cout); } } printEndGuard(moduleName, cout); }
static void doFile(const char* moduleName) { assert(moduleName); printBeginGuard(moduleName, cout); printCopyright(cout); cout << endl; cout << "#include \"AAFTypes.h\"" << endl; cout << endl; cout << "// AAF type definition UIDs." << endl << "//" << endl << endl; size_t i = 0; for (i = 0; i < sizeof(types)/sizeof(types[0]); i++){ printDefinition("const aafUID_t", prefix, types[i].name, 0, types[i].identifier, cout); } cout << endl; printEndGuard(moduleName, cout); }
void printBinaryInformation(FILE *fp, const ProgramContextInterface &programContext, const BinaryInformationSettings &settings) { const char *prefix = settings.prefix_; const char *suffix = settings.suffix_; const char *precisionString = ""; #ifdef GMX_DOUBLE precisionString = " (double precision)"; #endif const char *const name = programContext.displayName(); if (settings.bGeneratedByHeader_) { fprintf(fp, "%sCreated by:%s\n", prefix, suffix); } if (settings.bCopyright_) { GMX_RELEASE_ASSERT(prefix[0] == '\0' && suffix[0] == '\0', "Prefix/suffix not supported with copyright"); // This line is printed again after the copyright notice to make it // appear together with all the other information, so that it is not // necessary to read stuff above the copyright notice. // The line above the copyright notice puts the copyright notice is // context, though. // TODO: It would be nice to know here whether we are really running a // Gromacs binary or some other binary that is calling Gromacs; we // could then print "%s is part of GROMACS" or some alternative text. fprintf(fp, "%sGROMACS: %s, %s%s%s\n", prefix, name, gmx_version(), precisionString, suffix); fprintf(fp, "\n"); printCopyright(fp); fprintf(fp, "\n"); } fprintf(fp, "%sGROMACS: %s, %s%s%s\n", prefix, name, gmx_version(), precisionString, suffix); const char *const binaryPath = programContext.fullBinaryPath(); if (binaryPath != NULL && binaryPath[0] != '\0') { fprintf(fp, "%sExecutable: %s%s\n", prefix, binaryPath, suffix); } const char *const libraryPath = programContext.defaultLibraryDataPath(); if (libraryPath != NULL && libraryPath[0] != '\0') { fprintf(fp, "%sLibrary dir: %s%s\n", prefix, libraryPath, suffix); } const char *const commandLine = programContext.commandLine(); if (commandLine != NULL && commandLine[0] != '\0') { fprintf(fp, "%sCommand line:%s\n%s %s%s\n", prefix, suffix, prefix, commandLine, suffix); } if (settings.bExtendedInfo_) { GMX_RELEASE_ASSERT(prefix[0] == '\0' && suffix[0] == '\0', "Prefix/suffix not supported with extended info"); fprintf(fp, "\n"); gmx_print_version_info(fp); } }
static void doFile (const char * moduleName) { assert(moduleName); printBeginGuard(moduleName, cout); printCopyright(cout); cout << endl; cout << "#include \"AAFTypes.h\"" << endl; cout << endl; cout << "// AAF class definition UIDs." << endl << "//" << endl << endl; cout << "// The AAF reference implementation uses shorter names than" << endl << "// SMPTE. The names are shortened by the following aliases." << endl << "//" << endl; size_t maxNameLength = 0; size_t i = 0; for (i = 0; i < sizeof(aliases)/sizeof(aliases[0]); i++){ size_t length = strlen(aliases[i].alias); if (length > maxNameLength) { maxNameLength = length; } } size_t width = maxNameLength; for (i = 0; i < sizeof(aliases)/sizeof(aliases[0]); i++){ cout << "#define " << prefix; printName(aliases[i].alias, width, cout); cout << " " << prefix; printName(aliases[i].name, 0, cout); cout << endl; } cout << endl; for (i = 0; i < sizeof(classes)/sizeof(classes[0]); i++){ printDefinition("const aafUID_t", prefix, classes[i].name, 0, classes[i].identifier, cout); } printEndGuard(moduleName, cout); }
static void doFile(const char* moduleName) { assert(moduleName); printBeginGuard(moduleName, cout); printCopyright(cout); cout << endl; cout << "#include \"AAFTypes.h\"" << endl; cout << endl; cout << "// AAF property definition UIDs." << endl << "//" << endl << endl; size_t i = 0; for (i = 0; i < sizeof(properties)/sizeof(properties[0]); i++){ printDefinition("const aafUID_t", prefix, properties[i].name, 0, properties[i].identifier, cout); } Property_t special[] = { {"Root_MetaDictionary", {0x0D010301, 0x0101, 0x0100,{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02}}}, {"Root_Header", {0x0D010301, 0x0102, 0x0100, {0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02}}} }; cout << "// Special property definition ids used for specifying the" << endl; cout << "// starting strong reference in the target list of a" << endl; cout << "// weak reference." << endl; cout << "//" << endl; for (i = 0; i < sizeof(special)/sizeof(special[0]); i++){ printDefinition("const aafUID_t", prefix, special[i].name, 0, special[i].identifier, cout); } printEndGuard(moduleName, cout); }
static void doFile(const char* moduleName) { assert(moduleName); printBeginGuard(moduleName, cout); printCopyright(cout); cout << endl; cout << "// AAF property identifiers (PIDs)." << endl << "//" << endl << endl; cout << "// A property is identified by a globally unique 16-byte" << endl << "// identifier. To save space in an AAF file we store a" << endl << "// 2-byte file unique PID with each property." << endl << "// The mapping for a particular file is recorded in the" << endl << "// dictionary contained in that file." << endl << "// For the predefined properties we optimize by using a" << endl << "// fixed, compiled-in mapping." << endl << "// This file defines that mapping." << endl << "//" << endl; size_t maxNameLength = 0; size_t i = 0; for (i = 0; i < sizeof(properties)/sizeof(properties[0]); i++) { size_t length = strlen(properties[i].name); if (length > maxNameLength) { maxNameLength = length; } } for (i = 0; i < sizeof(properties)/sizeof(properties[0]); i++) { printDefinition("const int", "PID_", properties[i].name, maxNameLength, properties[i].identifier, cout); } printEndGuard(moduleName, cout); }
static void doFile (const char * moduleName) { assert(moduleName); printBeginGuard(moduleName, cout); printCopyright(cout); cout << endl; cout << "#include \"AAFTypes.h\"" << endl; cout << endl; cout << "// AAF stored object UIDs." << endl << "//" << endl << endl; cout << "#if !defined(INIT_AUID)" << endl; cout << "#define "; cout << "DEFINE_AUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \\" << endl; cout << " extern \"C\" const aafUID_t name" << endl; cout << "#else" << endl; cout << "#define "; cout << "DEFINE_AUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \\" << endl; cout << " extern \"C\" const aafUID_t name = \\" << endl; cout << " { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }" << endl; cout << "#endif" << endl; cout << endl; cout << "// The AAF reference implementation uses shorter names than" << endl << "// SMPTE. The names are shortened by the following aliases." << endl << "//" << endl; size_t maxNameLength = 0; size_t i = 0; for (i = 0; i < sizeof(aliases)/sizeof(aliases[0]); i++){ size_t length = strlen(aliases[i].alias); if (length > maxNameLength) { maxNameLength = length; } } size_t width = maxNameLength; for (i = 0; i < sizeof(aliases)/sizeof(aliases[0]); i++){ cout << "#define " << prefix; printName(aliases[i].alias, width, cout); cout << " " << prefix; printName(aliases[i].name, 0, cout); cout << endl; } cout << endl; for (i = 0; i < sizeof(classes)/sizeof(classes[0]); i++){ printMacroInvocation(prefix, "DEFINE_AUID", classes[i].name, classes[i].identifier, cout); cout << endl; } printEndGuard(moduleName, cout); }
/** * Entry point for the rmsd program. This program calculates the RMSD of the passed in structures. * * @param argc The argument count. * @param argv The argument values. */ int main(int argc, char** argv) { int i; //Print the copyright notice. printCopyright(argc, argv); //Parse the arguments. if (!parseArgs(argc, argv)) { //If the arguments were not valid, print the usage and exit printUsage(argc, argv); exit(1); } //Create an alphabet for reading the sequences. //AlphabetBuilder* alphabetBuilder = new AlphabetBuilder(); Alphabet* alphabet; char* backboneAtom; if (dna) { alphabet = AlphabetBuilder::createDnaAlphabet(); backboneAtom = (char*) "P"; } else if (rna) { alphabet = AlphabetBuilder::createRnaAlphabet(); backboneAtom = (char*) "P"; } else { alphabet = AlphabetBuilder::createProteinAlphabet(); backboneAtom = (char*) "CA"; } //Create the reader. StructureAlignmentReader* reader = new StructureAlignmentReader(alphabet,backboneAtom); reader->setAlignmentPath(""); if (reader->setAlignmentFilename(fastaFilename) == 0) { printf("Error: file %s was not found.\n", fastaFilename); exit(1); } reader->setStructurePath(pdbDir); //Read the alignment. StructureAlignment* alignment = reader->getStructureAlignment(); if (alignment == NULL) { printf("Error: file %s was not a valid FASTA file.\n", fastaFilename); exit(1); } printf("Read alignment from '%s': %d sequences of length %d\n", fastaFilename, alignment->getNumberStructures(), alignment->getNumberPositions()); //Make sure all of the sequences are of the same length. int length = -1; if (alignment->getNumberStructures() > 0) length = alignment->getStructure(0)->getSize(); for (i=1; i<alignment->getNumberStructures(); i++) { if (alignment->getStructure(i)->getSize() != length) { printf("Error: file %s did not contain a sequence alignment.\n", fastaFilename); exit(1); } } if (!perResidue) { RmsdTools *rmsdTools = new RmsdTools(alignment); rmsdTools->rmsd(); FILE *out = fopen(outputFilename,"w"); rmsdTools->printRmsd(out); fclose(out); } else { RmsdTools *rmsdTools = new RmsdTools(alignment); rmsdTools->rmsdPerResidue(); FILE *out = fopen(outputFilename,"w"); rmsdTools->printRmsdPerResidue(out); fclose(out); } //Free any used memory. //delete alphabetBuilder; delete alphabet; delete reader; return 0; }
/* Read project preferences and command line arguments */ static int parseParameters(int argc, const char** argv, SeparationFlags* sfOut) { poptContext context; int argRead; static int version = FALSE; static int copyright = FALSE; static unsigned int numParams = 0; static int serverParams = 0; static const char** rest = NULL; static SeparationFlags sf; static const struct poptOption options[] = { { "astronomy-parameter-file", 'a', POPT_ARG_STRING, &sf.ap_file, 0, "Astronomy parameter file", NULL }, { "star-points-file", 's', POPT_ARG_STRING, &sf.star_points_file, 0, "Star points files", NULL }, { "output", 'o', POPT_ARG_STRING, &sf.separation_outfile, 0, "Output file for separation (enables separation)", NULL }, { "seed", 'e', POPT_ARG_INT, &sf.separationSeed, SEED_ARGUMENT, "Seed for random number generator", NULL }, { "modfit", 'f', POPT_ARG_NONE, &sf.modfit, 0, "Modified fit from Newby 2011", NULL }, { "newbg", 'y', POPT_ARG_NONE, &sf.background, 0, "Uses broken power law as background fit", NULL }, { "ignore-checkpoint", 'i', POPT_ARG_NONE, &sf.ignoreCheckpoint, 0, "Ignore the checkpoint file", NULL }, { "cleanup-checkpoint", 'c', POPT_ARG_NONE, &sf.cleanupCheckpoint, 0, "Delete checkpoint on successful", NULL }, { "print-likelihood-text", 't', POPT_ARG_NONE, &sf.LikelihoodToText, 0, "Create text file with likelihood for use in local MLE", NULL }, { "debug-boinc", 'g', POPT_ARG_NONE, &sf.debugBOINC, 0, "Init BOINC with debugging. No effect if not built with BOINC_APPLICATION", NULL }, { "process-priority", 'b', POPT_ARG_INT, &sf.processPriority, 0, "Set process priority. Set priority 0 (lowest) to 4 (highest)", NULL }, { "device", 'd', POPT_ARG_INT, &sf.useDevNumber, 0, "Device number passed by BOINC to use", NULL }, { "non-responsive", 'r', POPT_ARG_NONE, &sf.nonResponsive, 0, "Do not care about display responsiveness (use with caution)", NULL }, { "gpu-target-frequency", 'q', POPT_ARG_DOUBLE, &sf.targetFrequency, 0, "Target frequency for GPU tasks" , NULL }, { "gpu-wait-factor", 'w', POPT_ARG_DOUBLE, &sf.waitFactor, 0, "Wait correction factor when using high CPU workarounds" , NULL }, { "gpu-polling-mode", 'm', POPT_ARG_INT, &sf.pollingMode, 0, "Interval for polling GPU: (-2 (default): Use mode -1 unless working around high CPU driver issue. -1: use clWaitForEvents(). 0: Use clWaitForEvents() with initial wait, >= 1: sets manual interval polling in ms)" , NULL }, { "gpu-disable-checkpointing", 'k', POPT_ARG_NONE, &sf.disableGPUCheckpointing, 0, "Disable checkpointing with GPUs" , NULL }, { "platform", 'l', POPT_ARG_INT, &sf.usePlatform, 0, "CL platform index to use", NULL }, { "platform-vendor", '\0', POPT_ARG_STRING, &sf.preferredPlatformVendor, 0, "CL Platform vendor name to try to use", NULL }, { "verbose", '\0', POPT_ARG_NONE, &sf.verbose, 0, "Print some extra debugging information", NULL }, { "force-no-opencl", '\0', POPT_ARG_NONE, &sf.forceNoOpenCL, 0, "Use regular CPU path instead of OpenCL if available", NULL }, { "force-no-il-kernel", '\0', POPT_ARG_NONE, &sf.forceNoILKernel, 0, "Do not use AMD IL replacement kernels if available", NULL }, { "force-no-intrinsics", '\0', POPT_ARG_NONE, &sf.forceNoIntrinsics, 0, "Use old default path", NULL }, { "force-x87", '\0', POPT_ARG_NONE, &sf.forceX87, 0, "Force to use x87 path (ignored if x86_64)", NULL }, { "force-sse2", '\0', POPT_ARG_NONE, &sf.forceSSE2, 0, "Force to use SSE2 path", NULL }, { "force-sse3", '\0', POPT_ARG_NONE, &sf.forceSSE3, 0, "Force to use SSE3 path", NULL }, { "force-sse4.1", '\0', POPT_ARG_NONE, &sf.forceSSE41, 0, "Force to use SSE4.1 path", NULL }, { "force-avx", '\0', POPT_ARG_NONE, &sf.forceAVX, 0, "Force to use AVX path", NULL }, { "p", 'p', POPT_ARG_NONE, &serverParams, 0, "Unused dummy argument to satisfy primitive arguments the server sends", NULL }, { "np", '\0', POPT_ARG_INT | POPT_ARGFLAG_ONEDASH, &numParams, 0, "Unused dummy argument to satisfy primitive arguments the server sends", NULL }, { "version", 'v', POPT_ARG_NONE, &version, 0, "Print version information", NULL }, { "copyright", '\0', POPT_ARG_NONE, ©right, 0, "Print copyright information and exit", NULL }, POPT_AUTOHELP POPT_TABLEEND }; setInitialFlags(&sf); context = poptGetContext(argv[0], argc, argv, options, POPT_CONTEXT_POSIXMEHARDER); if (!context) { mw_printf("Failed to get popt context\n"); exit(EXIT_FAILURE); } if (argc < 2) { poptPrintUsage(context, stderr, 0); poptFreeContext(context); exit(EXIT_FAILURE); } argRead = mwReadArguments(context); if (argRead < 0) { poptFreeContext(context); freeSeparationFlags(&sf); exit(EXIT_FAILURE); } if (version) { printVersion(FALSE, sf.verbose); } if (copyright) { printCopyright(); } if (version || copyright) { exit(EXIT_SUCCESS); } sf.setSeed = !!(argRead & SEED_ARGUMENT); /* Check if these flags were used */ sf.do_separation = (sf.separation_outfile && strcmp(sf.separation_outfile, "")); if (sf.do_separation) prob_ok_init(sf.separationSeed, sf.setSeed); rest = poptGetArgs(context); sf.forwardedArgs = mwGetForwardedArguments(rest, &sf.nForwardedArgs); sf.numArgs = mwReadRestArgs(rest, sf.nForwardedArgs); /* Temporary */ poptFreeContext(context); setDefaults(&sf); *sfOut = sf; return 0; }
/** * Entry point for the qpair program. * * @param argc The argument count. * @param argv The argument values. */ int main(int argc, char** argv) { //Print the copyright notice. printCopyright(argc, argv); //Parse the arguments. if (!parseArgs(argc, argv)) { //If the arguments were not valid, print the usage and exit. printUsage(argc, argv); exit(1); } // printf("Done parsing args. calcType: %d, alph: %d, fasta: %s, Dir: %s\n", calculationType, alphabetType, fastaFilename, pdbDir); StructureAlignment* structAl1 = readStructureAlignment(fastaFilename, pdbDir); // printf("Done creating structAl1\n"); if (structAl1 == NULL) { printf("Error: couldn't read structure alignment\n"); exit(1); } //QTools* qTools = 0; StructureQR* structQR = 0; FILE* out = 0; //char* kArgString = 0; //int check = 0; switch(calculationType) { /* case QH: qTools = new QTools(structAl1); qTools->q(0); out = fopen(outputFilename,"w"); qTools->printQ(out); fclose(out); break; case QPERRESIDUE: qTools = new QTools(structAl1); qTools->qPerResidue(); out = fopen(outputFilename,"w"); qTools->printQPerResidue(out); fclose(out); break; */ case QR: structQR = new StructureQR(structAl1); // printf("Preparing to do structQR->qr()\n"); structQR->qr(); out = fopen(outputFilename,"w"); // printf("Preparing to print Columns\n"); structQR->printColumns(out); fclose(out); delete structQR; break; default: printf("Error: invalid calculationType\n"); exit(1); } delete structAl1; /******** if (qTools != 0) { // XXX - SEGFAULT WHEN QTOOLS IS DELETED delete qTools; } */ return 0; }
void printBinaryInformation(FILE *fp, const ProgramContextInterface &programContext, const BinaryInformationSettings &settings) { const char *prefix = settings.prefix_; const char *suffix = settings.suffix_; const char *precisionString = ""; #ifdef GMX_DOUBLE precisionString = " (double precision)"; #endif const char *const name = programContext.displayName(); if (settings.bGeneratedByHeader_) { fprintf(fp, "%sCreated by:%s\n", prefix, suffix); } // TODO: It would be nice to know here whether we are really running a // Gromacs binary or some other binary that is calling Gromacs; we // could then print "%s is part of GROMACS" or some alternative text. std::string title = formatString(":-) GROMACS - %s, %s%s (-:", name, gmx_version(), precisionString); const int indent = centeringOffset(78 - strlen(prefix) - strlen(suffix), title.length()) + 1; fprintf(fp, "%s%*c%s%s\n", prefix, indent, ' ', title.c_str(), suffix); fprintf(fp, "%s%s\n", prefix, suffix); if (settings.bCopyright_) { GMX_RELEASE_ASSERT(prefix[0] == '\0' && suffix[0] == '\0', "Prefix/suffix not supported with copyright"); printCopyright(fp); fprintf(fp, "\n"); // This line is printed again after the copyright notice to make it // appear together with all the other information, so that it is not // necessary to read stuff above the copyright notice. // The line above the copyright notice puts the copyright notice is // context, though. fprintf(fp, "%sGROMACS: %s, %s%s%s\n", prefix, name, gmx_version(), precisionString, suffix); } const char *const binaryPath = programContext.fullBinaryPath(); if (!gmx::isNullOrEmpty(binaryPath)) { fprintf(fp, "%sExecutable: %s%s\n", prefix, binaryPath, suffix); } const gmx::InstallationPrefixInfo installPrefix = programContext.installationPrefix(); if (!gmx::isNullOrEmpty(installPrefix.path)) { fprintf(fp, "%sData prefix: %s%s%s\n", prefix, installPrefix.path, installPrefix.bSourceLayout ? " (source tree)" : "", suffix); } const char *const commandLine = programContext.commandLine(); if (!gmx::isNullOrEmpty(commandLine)) { fprintf(fp, "%sCommand line:%s\n%s %s%s\n", prefix, suffix, prefix, commandLine, suffix); } if (settings.bExtendedInfo_) { GMX_RELEASE_ASSERT(prefix[0] == '\0' && suffix[0] == '\0', "Prefix/suffix not supported with extended info"); fprintf(fp, "\n"); gmx_print_version_info(fp); } }