void cloth::SwFactory::extractCollisionData(const Cloth& cloth, Range<PxVec4> spheres, Range<uint32_t> capsules, Range<PxVec4> planes, Range<uint32_t> convexes, Range<PxVec3> triangles) const { PX_ASSERT(&cloth.getFactory() == this); const SwCloth& swCloth = static_cast<const SwClothImpl&>(cloth).mCloth; PX_ASSERT(spheres.empty() || spheres.size() == swCloth.mStartCollisionSpheres.size()); PX_ASSERT(capsules.empty() || capsules.size() == swCloth.mCapsuleIndices.size() * 2); PX_ASSERT(planes.empty() || planes.size() == swCloth.mStartCollisionPlanes.size()); PX_ASSERT(convexes.empty() || convexes.size() == swCloth.mConvexMasks.size()); PX_ASSERT(triangles.empty() || triangles.size() == swCloth.mStartCollisionTriangles.size()); if(!swCloth.mStartCollisionSpheres.empty() && !spheres.empty()) memcpy(spheres.begin(), &swCloth.mStartCollisionSpheres.front(), swCloth.mStartCollisionSpheres.size() * sizeof(PxVec4)); if(!swCloth.mCapsuleIndices.empty() && !capsules.empty()) memcpy(capsules.begin(), &swCloth.mCapsuleIndices.front(), swCloth.mCapsuleIndices.size() * sizeof(IndexPair)); if(!swCloth.mStartCollisionPlanes.empty() && !planes.empty()) memcpy(planes.begin(), &swCloth.mStartCollisionPlanes.front(), swCloth.mStartCollisionPlanes.size() * sizeof(PxVec4)); if(!swCloth.mConvexMasks.empty() && !convexes.empty()) memcpy(convexes.begin(), &swCloth.mConvexMasks.front(), swCloth.mConvexMasks.size() * sizeof(uint32_t)); if(!swCloth.mStartCollisionTriangles.empty() && !triangles.empty()) memcpy(triangles.begin(), &swCloth.mStartCollisionTriangles.front(), swCloth.mStartCollisionTriangles.size() * sizeof(PxVec3)); }
void estimateGeometry(Shape& s, const double& h, const Range& r, vector<Point>& points, vector<Point>& tangents, vector<Quantity>& curvatures) { typedef typename Range::ConstIterator ConstIterator; typedef ParametricShapeTangentFunctor< Shape > TangentFunctor; typedef ParametricShapeCurvatureFunctor< Shape > CurvatureFunctor; for (ConstIterator i = r.begin(); i != r.end(); ++i) { Point p( *i ); p *= h; points.push_back(p); } TrueLocalEstimatorOnPoints< ConstIterator, Shape, TangentFunctor > trueTangentEstimator; TrueLocalEstimatorOnPoints< ConstIterator, Shape, CurvatureFunctor > trueCurvatureEstimator; trueTangentEstimator.init( h, r.begin(), r.end(), &s, false); tangents = estimateQuantity( trueTangentEstimator, r.begin(), r.end() ); trueCurvatureEstimator.init( h, r.begin(), r.end(), &s, false); curvatures = estimateQuantity( trueCurvatureEstimator, r.begin(), r.end() ); }
cloth::SwCloth::SwCloth( SwFactory& factory, SwFabric& fabric, Range<const PxVec4> particles) : mFactory(factory), mFabric(fabric), mNumVirtualParticles(0), mUserData(0) { PX_ASSERT(!particles.empty()); initialize(*this, particles.begin(), particles.end()); #if defined(PX_WINDOWS) const uint32_t kSimdWidth = 8; // avx #elif defined(PX_X360) || defined(PX_PS3) const uint32_t kSimdWidth = 8; // unrolled loop #else const uint32_t kSimdWidth = 4; // sse #endif mCurParticles.reserve(particles.size() + kSimdWidth-1); mCurParticles.assign( reinterpret_cast<const PxVec4*>(particles.begin()), reinterpret_cast<const PxVec4*>(particles.end())); // 7 dummy particles used in SIMD solver mCurParticles.resize(particles.size() + kSimdWidth-1, PxVec4(0.0f)); mPrevParticles = mCurParticles; mCurParticles.resize(particles.size()); mPrevParticles.resize(particles.size()); mFabric.incRefCount(); }
cloth::SwCloth::SwCloth(SwFactory& factory, SwFabric& fabric, Range<const PxVec4> particles) : mFactory(factory) , mFabric(fabric) , mNumVirtualParticles(0) #if APEX_UE4 , mSimulationTask(nullptr) #endif , mUserData(0) { PX_ASSERT(!particles.empty()); initialize(*this, particles.begin(), particles.end()); #if PX_WINDOWS_FAMILY const uint32_t kSimdWidth = 8; // avx #else const uint32_t kSimdWidth = 4; // sse #endif mCurParticles.reserve(particles.size() + kSimdWidth - 1); mCurParticles.assign(reinterpret_cast<const PxVec4*>(particles.begin()), reinterpret_cast<const PxVec4*>(particles.end())); // 7 dummy particles used in SIMD solver mCurParticles.resize(particles.size() + kSimdWidth - 1, PxVec4(0.0f)); mPrevParticles = mCurParticles; mCurParticles.resize(particles.size()); mPrevParticles.resize(particles.size()); mFabric.incRefCount(); }
Range HttpUtils::checkHost(const Range &range) { Range host(range); int length = range.size(); const char *end_pos = range.begin() + length - 1; bool remove_port = false; for (int i = 0; i < length; ++i) { if (*(end_pos - i) == ':' && i + 1 != length) { if (i == 2 && *(end_pos - 1) == '8' && *end_pos == '0') { remove_port = true; } host = Range(range.begin(), end_pos - i); break; } } for(const char *it = host.begin(); it != host.end(); ++it) { if (*it == '/' || *it == ':') { throw std::runtime_error("Incorrect host"); } } if (remove_port) { return host; } return range; }
void cloth::SwFactory::extractFabricData(const Fabric& fabric, Range<uint32_t> phases, Range<uint32_t> sets, Range<float> restvalues, Range<uint32_t> indices, Range<uint32_t> anchors, Range<float> tetherLengths) const { const SwFabric& swFabric = static_cast<const SwFabric&>(fabric); PX_ASSERT(phases.empty() || phases.size() == swFabric.getNumPhases()); PX_ASSERT(restvalues.empty() || restvalues.size() == swFabric.getNumRestvalues()); PX_ASSERT(sets.empty() || sets.size() == swFabric.getNumSets()); PX_ASSERT(indices.empty() || indices.size() == swFabric.getNumIndices()); PX_ASSERT(anchors.empty() || anchors.size() == swFabric.getNumTethers()); PX_ASSERT(tetherLengths.empty() || tetherLengths.size() == swFabric.getNumTethers()); for(uint32_t i=0; !phases.empty(); ++i, phases.popFront()) phases.front() = swFabric.mPhases[i]; const uint32_t* sEnd = swFabric.mSets.end(), *sIt; const float* rBegin = swFabric.mRestvalues.begin(), *rIt = rBegin; const uint16_t* iIt = swFabric.mIndices.begin(); uint32_t* sDst = sets.begin(); float* rDst = restvalues.begin(); uint32_t* iDst = indices.begin(); uint32_t numConstraints = 0; for(sIt = swFabric.mSets.begin(); ++sIt != sEnd; ) { const float* rEnd = rBegin + *sIt; for(; rIt != rEnd; ++rIt) { uint16_t i0 = *iIt++; uint16_t i1 = *iIt++; if(PxMax(i0, i1) >= swFabric.mNumParticles) continue; if(!restvalues.empty()) *rDst++ = *rIt; if(!indices.empty()) { *iDst++ = i0; *iDst++ = i1; } ++numConstraints; } if(!sets.empty()) *sDst++ = numConstraints; } for(uint32_t i=0; !anchors.empty(); ++i, anchors.popFront()) anchors.front() = swFabric.mTethers[i].mAnchor; for(uint32_t i=0; !tetherLengths.empty(); ++i, tetherLengths.popFront()) tetherLengths.front() = swFabric.mTethers[i].mLength * swFabric.mTetherLengthScale; }
typename Range::iterator::value_type operator|(Range range, _first) { return range.begin() != range.end() ? *(range.begin()) : typename Range::iterator::value_type(); }
int main() { ErrorCode rval; Core moab; Interface& mb = moab; // load test file rval = mb.load_file( default_input_file ); if (MB_SUCCESS != rval) { std::cerr << default_input_file <<": failed to load file." << std::endl; return 1; } // get all region elements Range vols; rval = mb.get_entities_by_dimension( 0, 3, vols ); if (MB_SUCCESS != rval) return 2; if (vols.empty()) return 1; // create internal face elements Range faces; rval = mb.get_adjacencies( vols, 2, true, faces, Interface::UNION ); if (MB_SUCCESS != rval) return 2; assert(faces.size() > vols.size()); // time query of all adjacent volumes std::vector<EntityHandle> adj; clock_t t_0 = clock(); for (Range::iterator i = faces.begin(); i != faces.end(); ++i) { adj.clear(); rval = mb.get_adjacencies( &*i, 1, 3, false, adj ); if (MB_SUCCESS != rval) return 2; assert( adj.size() == 1 || adj.size() == 2 ); } clock_t t_up = clock() - t_0; std::cout << "Querying of volumes for " << faces.size() << " faces: " << t_up/(double)CLOCKS_PER_SEC << " seconds" << std::endl; // time downward adjacency query from volumes to faces t_0 = clock(); for (Range::iterator i = vols.begin(); i != vols.end(); ++i) { adj.clear(); rval = mb.get_adjacencies( &*i, 1, 1, false, adj ); if (MB_SUCCESS != rval) return 2; assert( adj.size() > 3 ); } clock_t t_down = clock() - t_0; std::cout << "Querying of faces for " << vols.size() << " volumes: " << t_down/(double)CLOCKS_PER_SEC << " seconds" << std::endl; return 0; }
bool pairwise_all_of(const Range& a, const Range& b, Binary_Predicate p) { auto a1 = a.begin(), a2 = a.end(); auto b1 = b.begin(), b2 = b.end(); while (a1 != a2 && b1 != b2 && p(*a1, *b1)) { ++a1; ++b1; } return a1 == a2 || b1 == b2; }
bool lambda64ByPoint () { Segmentation segmenter ( curve.begin(), curve.end(), SegmentComputer() ); LambdaMST2D < Segmentation > lmst64; lmst64.attach ( segmenter ); for ( ConstIterator it = curve.begin(); it != curve.end(); ++it ) lmst64.eval ( *it ); return true; }
set_env_(const Range &envs) { std::size_t s = std::accumulate(envs.begin(), envs.end(), std::size_t(0), &set_env_::get_size); env_.resize(s + 1); std::for_each(envs.begin(), envs.end(), copy_env(env_.data())); env_[env_.size() - 1] = 0; }
bool lambda64() { Segmentation segmenter ( curve.begin(), curve.end(), SegmentComputer() ); LambdaMST2D < Segmentation > lmst64; lmst64.attach ( segmenter ); lmst64.init ( curve.begin(), curve.end() ); std::vector < RealVector > tangent; lmst64.eval < back_insert_iterator< vector < RealVector > > > ( curve.begin(), curve.end(), back_inserter ( tangent ) ); return true; }
RequestFile::RequestFile(const Range &remote_name, const Range &type, const Range &content) : data_(content.begin(), static_cast<std::streamsize>(content.size())) { if (!remote_name.empty()) { remote_name_.assign(remote_name.begin(), remote_name.end()); } if (!type.empty()) { type_.assign(type.begin(), type.end()); } }
//! Run body for range, serves as callback for partitioner void run_body( Range &r ) { my_body(r); if (m_firstTimeRun) { m_firstTimeRun = false; m_executedBegin = m_executedEnd = r.begin(); } ASSERT(m_executedBegin <= r.begin() && m_executedEnd < r.end(), "Non-continuous execution"); m_executedEnd = r.end(); }
ErrorCode WriteVtk::write_bit_tag(std::ostream& stream, Tag tag, const Range& entities, const Range& tagged) { ErrorCode rval; const unsigned long n = entities.size(); // Get tag properties std::string name; int vals_per_tag; if (MB_SUCCESS != mbImpl->tag_get_name(tag, name) || MB_SUCCESS != mbImpl->tag_get_length(tag, vals_per_tag)) return MB_FAILURE; if (vals_per_tag > 8) { MB_SET_ERR(MB_FAILURE, "Invalid tag size for bit tag \"" << name << "\""); } // Get a tag value for each entity. // Get bits for each entity and unpack into // one integer in the 'data' array for each bit. // Initialize 'data' to zero because we will skip // those entities for which the tag is not set. std::vector<unsigned short> data; data.resize(n * vals_per_tag, 0); Range::const_iterator t = tagged.begin(); std::vector<unsigned short>::iterator d = data.begin(); for (Range::const_iterator i = entities.begin(); i != entities.end() && t != tagged.end(); ++i) { if (*i == *t) { ++t; unsigned char value; rval = mbImpl->tag_get_data(tag, &(*i), 1, &value); for (int j = 0; j < vals_per_tag; ++j, ++d) *d = (unsigned short)(value & (1 << j) ? 1 : 0); if (MB_SUCCESS != rval) return rval; } else { // If tag is not set for entity, skip values in array d += vals_per_tag; } } // Write the tag values, one entity per line. write_data(stream, data, vals_per_tag); return MB_SUCCESS; }
ErrorCode compute_velocity_case1(Interface * mb, EntityHandle euler_set, Tag & tagh, int rank, int tStep) { ErrorCode rval = MB_SUCCESS; Range polygons; rval = mb->get_entities_by_dimension(euler_set, 2, polygons); if (MB_SUCCESS != rval) return rval; Range connecVerts; rval = mb->get_connectivity(polygons, connecVerts); if (MB_SUCCESS != rval) return rval; void *data; // pointer to the velo in memory, for each vertex int count; rval = mb->tag_iterate(tagh, connecVerts.begin(), connecVerts.end(), count, data); CHECK_ERR(rval); // here we are checking contiguity assert(count == (int) connecVerts.size()); double * ptr_velo=(double*)data; // lambda is for longitude, theta for latitude for (Range::iterator vit=connecVerts.begin();vit!=connecVerts.end(); vit++ ) { EntityHandle oldV=*vit; CartVect posi; rval = mb->get_coords(&oldV, 1, &(posi[0]) ); CHECK_ERR(rval); CartVect velo ; double t = T * tStep/numSteps; // velocity_case1(posi, t, velo); ptr_velo[0]= velo[0]; ptr_velo[1]= velo[1]; ptr_velo[2]= velo[2]; // increment to the next node ptr_velo+=3;// to next velocity } std::stringstream velos; velos<<"Tracer" << rank<<"_"<<tStep<< ".vtk"; rval = mb->write_file(velos.str().c_str(), 0, 0, &euler_set, 1, &tagh, 1); CHECK_ERR(rval); return MB_SUCCESS; }
iterator_range< boost::transform_iterator< F, typename boost::range_iterator<const Range>::type> > make_transformed(const Range& range, F f) { return { boost::make_transform_iterator(range.begin(), f), boost::make_transform_iterator(range.end(), f) }; }
range_iterator Group::Delete(Range r, range_iterator range) { for (; range != rangeList.end(); range++) if (r.Intersects(*range) || r.IsBefore(*range)) break; if (range == rangeList.end()) return range; else if (r.Intersects(*range)) { range_iterator savedRange = range; if (r.Splits(*range)) { Range newRange(r.end(), range->end()); *range = Range(range->begin(), r.begin()); range = rangeList.insert(range+1, newRange); return range; } else { while (range != rangeList.end()) { if (r.Contains(*range)) { rangeList.erase(range); } else { *range = range->Difference(r); range++; } } } return savedRange; } else return range; }
void generate_random_points( Interface& mb, size_t num_points, std::vector<CartVect>& points, std::vector<EntityHandle>& point_elems ) { Range elems; ErrorCode rval; rval = mb.get_entities_by_dimension( 0, 3, elems ); CHK(rval); if (!elems.all_of_type(MBHEX)) { std::cerr << "Warning: ignoring non-hexahedral elements." << std::endl; std::pair< Range::iterator, Range::iterator > p = elems.equal_range(MBHEX); elems.erase( p.second, elems.end() ); elems.erase( elems.begin(), p.first ); } if (elems.empty()) { std::cerr << "Input file contains no hexahedral elements." << std::endl; exit(1); } points.resize( num_points ); point_elems.resize( num_points ); const size_t num_elem = elems.size(); for (size_t i = 0; i < num_points; ++i) { size_t offset = 0; for (size_t x = num_elem; x > 0; x /= RAND_MAX) offset += rand(); offset %= num_elem; point_elems[i] = elems[offset]; points[i] = random_point_in_hex( mb, point_elems[i] ); } }
bool testPairsRange(const Range &aRange) { trace.info() << endl; trace.info() << "Testing Range (" << aRange.size() << " pairs)" << endl; { trace.info() << "Forward" << endl; typename Range::ConstIterator i = aRange.begin(); typename Range::ConstIterator end = aRange.end(); for ( ; i != end; ++i) { cout << (*i).first << " " << (*i).second << endl; } } { trace.info() << "Backward" << endl; typename Range::ConstReverseIterator i = aRange.rbegin(); typename Range::ConstReverseIterator end = aRange.rend(); for ( ; i != end; ++i) { cout << i->first << " " << i->second << endl; } } return true; }
void estimateGeometry(Shape& s, const double& h, const Range& r, std::vector<Point>& points, std::vector<Point>& tangents, std::vector<Quantity>& curvatures) { typedef typename Range::ConstIterator ConstIterator; for (ConstIterator i = r.begin(); i != r.end(); ++i) { Point p( *i ); p *= h; points.push_back(p); } typedef typename Range::ConstCirculator ConstCirculator; typedef ParametricShapeTangentFunctor< Shape > TangentFunctor; TrueLocalEstimatorOnPoints< ConstCirculator, Shape, TangentFunctor > trueTangentEstimator; trueTangentEstimator.attach(&s); trueTangentEstimator.init( h, r.c(), r.c()); trueTangentEstimator.eval(r.c(), r.c(), std::back_inserter(tangents) ); typedef ParametricShapeCurvatureFunctor< Shape > CurvatureFunctor; TrueLocalEstimatorOnPoints< ConstCirculator, Shape, CurvatureFunctor > trueCurvatureEstimator; trueCurvatureEstimator.attach(&s); trueCurvatureEstimator.init( h, r.c(), r.c()); trueCurvatureEstimator.eval(r.c(), r.c(), std::back_inserter(curvatures) ); }
void do_linear_test( Interface& mb, int , int , long num_test, const std::vector<CartVect>& points, std::vector<EntityHandle>& point_elems, clock_t& build_time, clock_t& test_time, size_t& depth ) { clock_t init = clock(); Range hexes; ErrorCode rval = mb.get_entities_by_type( 0, MBHEX, hexes ); CHK(rval); depth = 0; point_elems.resize( points.size() ); build_time = clock() - init; CartVect coords[8]; const EntityHandle* conn; int len; for (long i = 0; i < num_test; ++i) { const size_t idx = (size_t)i % points.size(); for (Range::iterator h = hexes.begin(); h != hexes.end(); ++h) { rval = mb.get_connectivity( *h, conn, len, true ); CHK(rval); rval = mb.get_coords( conn, 8, reinterpret_cast<double*>(coords) ); CHK(rval); if (GeomUtil::point_in_trilinear_hex( coords, points[idx], 1e-12 )) { point_elems[idx] = *h; break; } } } test_time = clock() - build_time; }
ErrorCode ReadDamsel::process_entity_tags(int count, damsel_container tag_container, damsel_container app_cont, Range &these_ents) { // process tags on these entities ErrorCode rval = MB_SUCCESS; for (int i = 0; i < count; i++) { damsel_handle dtagh = DMSLcontainer_handle_at_position(tag_container, i); // don't do conventional tags here std::vector<DamselUtil::tinfo>::iterator vit = std::find_if(dU.tagMap.begin(), dU.tagMap.end(), DamselUtil::DtagP<DamselUtil::tinfo>(dtagh)); if ((*vit).tagType == MB_TAG_ANY) continue; else if (vit == dU.tagMap.end()) CHK_MB_ERR(MB_FAILURE, "Failed to find tag."); Tag tagh = (*vit).mTagh; assert(tagh); void *tag_data; int ecount = these_ents.size(); rval = mbImpl->tag_iterate(tagh, these_ents.begin(), these_ents.end(), ecount, tag_data); CHK_MB_ERR(rval, "Problem getting tag iterator."); assert(ecount == (int)these_ents.size()); damsel_err_t err = DMSLmodel_map_tag(tag_data, app_cont, (damsel_handle_ptr)&tagh); CHK_DMSL_ERR(err, " "); } return rval; }
bool drawingTestStabbingCircleComputer(const TCurve& curve, const string& suffix) { typedef typename TCurve::IncidentPointsRange Range; //range Range r = curve.getIncidentPointsRange(); //range { typedef typename Range::ConstIterator ConstIterator; //iterator StabbingCircleComputer<ConstIterator> s; longestSegment(s,r.begin(),r.end()); Board2D board; board << r << s; std::stringstream ss; ss << "StabbingCircleComputerDrawingTest" << suffix << ".eps"; board.saveEPS(ss.str().c_str()); } { typedef typename Range::ConstReverseIterator ConstReverseIterator; //iterator StabbingCircleComputer<ConstReverseIterator> s; longestSegment(s,r.rbegin(),r.rend()); Board2D board; board << r << s; std::stringstream ss; ss << "StabbingCircleComputerDrawingTest" << suffix << "2.eps"; board.saveEPS(ss.str().c_str()); } return true; }
void ClothImpl<SwCloth>::setSelfCollisionIndices(Range<const uint32_t> indices) { ContextLockType lock(mCloth.mFactory); mCloth.mSelfCollisionIndices.assign(indices.begin(), indices.end()); mCloth.notifyChanged(); mCloth.wakeUp(); }
typename Range::iterator get_nth_iterator(Range &r, std::size_t n) { assert_bytes_remaining(r,n); typedef typename Range::iterator iterator; iterator ret = r.begin(); std::advance(ret, n); return ret; }
std::string get_string(Range &r) { boost::uint16_t const len = detail::get_2byte_size(r); std::string ret; std::copy(r.begin(), detail::get_nth_iterator(r, len), std::back_inserter(ret)); r.advance_begin(len); return ret; }
/** * Calculates the minimum and maximum co-ordinates over the given array * range. * \param range point range. */ void operator()(const Range& range) { // get pointers locally. Point min = pointsIn[0]; Point max = pointsIn[0]; // calculate the minimum and maximum co-ordinates over the range. for (index_t i = range.begin(); i != range.end(); ++i) { if (pointsIn[i].x < min.x) { min.x = pointsIn[i].x; } if (pointsIn[i].y < min.y) { min.y = pointsIn[i].y; } if (pointsIn[i].x > max.x) { max.x = pointsIn[i].x; } if (pointsIn[i].y > max.y) { max.y = pointsIn[i].y; } } // refresh member variables. minPoint = min; maxPoint = max; }
typename Range::iterator get_nth_iterator(Range &r, std::size_t n) { assert(r && static_cast<size_t>(r.size()) >= n); typedef typename Range::iterator iterator; iterator ret = r.begin(); std::advance(ret, n); return ret; }
// Action_MultiVector::Setup(); Action::RetType Action_MultiVector::Setup(Topology* currentParm, Topology** parmAddress) { Range actualRange; // If range is empty (i.e. no resrange arg given) look through all // solute residues. if (resRange_.Empty()) actualRange = currentParm->SoluteResidues(); else { // If user range specified, create new range shifted by -1 since internal // resnums start from 0. actualRange = resRange_; actualRange.ShiftBy(-1); } // Exit if no residues specified if (actualRange.Empty()) { mprinterr("Error: No residues specified for %s\n",currentParm->c_str()); return Action::ERR; } // Set default DataSet name if not specified. if (dsetname_.empty()) dsetname_ = masterDSL_->GenerateDefaultName( "MVEC" ); // Search for specified atom names in each residue in the range CrdIdx1_.clear(); CrdIdx2_.clear(); for (Range::const_iterator res = actualRange.begin(); res != actualRange.end(); ++res) { int atom1 = currentParm->FindAtomInResidue( *res, name1_ ); int atom2 = currentParm->FindAtomInResidue( *res, name2_ ); if (atom1 != -1 && atom2 != -1) { MetaData md(dsetname_, atom1+1); md.SetScalarMode( MetaData::M_VECTOR ); if (ired_) md.SetScalarType( MetaData::IREDVEC ); DataSet_Vector* ds = (DataSet_Vector*)masterDSL_->CheckForSet( md ); if (ds == 0) { // Create DataSet ds = (DataSet_Vector*)masterDSL_->AddSet( DataSet::VECTOR, md ); if (ds == 0) return Action::ERR; ds->SetLegend( "v" + currentParm->AtomMaskName(atom1) + "->" + currentParm->AtomMaskName(atom2) ); if (outfile_ != 0) outfile_->AddDataSet( ds ); } data_.push_back( ds ); CrdIdx1_.push_back( atom1 * 3 ); // Pre calc coordinate index CrdIdx2_.push_back( atom2 * 3 ); } else if ((atom1==-1) != (atom2==-1)) { if (atom1==-1) mprintf("Warning: '%s' not found but '%s' found for residue %i.\n", *name1_, *name2_, *res + 1); else // atom2==-1 mprintf("Warning: '%s' not found but '%s' found for residue %i.\n", *name2_, *name1_, *res + 1); } } mprintf("\tSelected %zu vectors.\n", CrdIdx1_.size()); for (std::vector<DataSet_Vector*>::const_iterator it = data_.begin(); it != data_.end(); ++it) mprintf("\t %s\n", (*it)->legend()); return Action::OK; }