本文整理汇总了C++中AtomList类的典型用法代码示例。如果您正苦于以下问题:C++ AtomList类的具体用法?C++ AtomList怎么用?C++ AtomList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AtomList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: m__dir
void pybase::m__dir(PyObject *obj)
{
AtomList lst;
GetDir(obj,lst);
// dump dir to attribute outlet
DumpOut(NULL,lst.Count(),lst.Atoms());
}
示例2: allAtomsFlattened
ExtendedIdListItemSetVector ExtendedIdListItemSet::subSequences() {
ExtendedIdListItemSetVector subSequences;
AtomList atomsFlattened = allAtomsFlattened();
for (int i = 0; i < atomsFlattened.size(); ++i) {
AtomList atomList;
int o = i + 1;
for (int j = 0; j < atomsFlattened.size(); ++j) {
if (j != o) {
atomList.push_back(atomsFlattened[j]);
}
}
ExtendedIdListItemSet subItemSet;
for (auto atom : atomList) {
auto atomSetIt = find_if(begin(_atomSets), end(_atomSets), [&atom](AtomSet atomSet) {
return find(begin(atomSet.atoms()), end(atomSet.atoms()), atom) != end(atomSet.atoms());
});
int index = std::distance(begin(_atomSets), atomSetIt);
if (index < subItemSet.atomSets().size()) {
subItemSet.addAtomToAtomSetAtIndex(atom, index);
} else {
subItemSet.addAtomSet(AtomSet(atom));
}
}
subSequences.push_back(subItemSet);
}
return subSequences;
}
示例3: atoms
AtomList atoms(const AtomContainer& fragment, const String& expression)
{
AtomList result;
// iterate over all atoms
AtomConstIterator it = fragment.beginAtom();
if (expression == "")
{
for (; +it; ++it)
{
// store the atom pointer in the list
result.push_back(const_cast<Atom*>(&*it));
}
}
else
{
Expression match(expression);
for (; +it; ++it)
{
if (match(*it))
{
// store the atom pointer in the list
result.push_back(const_cast<Atom*>(&*it));
}
}
}
return result;
}
示例4: get_Regressifier_instance
void regression::map(int argc, const t_atom *argv)
{
GRT::UINT numSamples = regression_data.getNumSamples();
GRT::Regressifier ®ressifier = get_Regressifier_instance();
if (numSamples == 0)
{
error("no observations added, use 'add' to add training data");
return;
}
if (regressifier.getTrained() == false)
{
error("data_typel has not been trained, use 'train' to train the data_typel");
return;
}
GRT::UINT numInputNeurons = regressifier.getNumInputFeatures();
GRT::VectorDouble query(numInputNeurons);
if (argc < 0 || (unsigned)argc != numInputNeurons)
{
error("invalid input length, expected " + std::to_string(numInputNeurons) + " got " + std::to_string(argc));
}
for (uint32_t index = 0; index < (uint32_t)argc; ++index)
{
double value = GetAFloat(argv[index]);
query[index] = value;
}
bool success = regressifier.predict(query);
if (success == false)
{
error("unable to map input");
return;
}
GRT::VectorDouble regression_data = regressifier.getRegressionData();
GRT::VectorDouble::size_type numOutputDimensions = regression_data.size();
if (numOutputDimensions != regressifier.getNumOutputDimensions())
{
error("invalid output dimensions: " + std::to_string(numOutputDimensions));
return;
}
AtomList result;
for (uint32_t index = 0; index < numOutputDimensions; ++index)
{
t_atom value_a;
double value = regression_data[index];
SetFloat(value_a, value);
result.Append(value_a);
}
ToOutList(0, result);
}
示例5: reconec
void MoleculaB::reconec (double param)
{ //IGUAL QUE PONCONEC; pero sin iniciar --> JUST AS PONCONEC; but without initiating
int nv = susatomos.size ();
for (int i = 0; i < nv; i++) {
Atomo *atm = susatomos.get(i);
atm->index = i;
}
for (int i = 0; i < nv; i++) {
Atomo *atm = susatomos.get (i);
pto3D ptoa = atm->vert;
int tipA = atm->tipo;
AtomList alst = susatomos.neighborhood(atm);
for (int j = 0; j < alst.size(); j++) {
Atomo *atm2 = alst.get(j);
pto3D ptob = atm2->vert;
int tipB = atm2->tipo;
double distamax = param * (periodicTable()->en1[tipA] +
periodicTable()->en1[tipB]); //PARAMETRO AQUI
if (ptoa.dista (ptob) < distamax && ptoa.dista (ptob) > 0.6)
conecta (i, atm2->index);
}
}
//depuraconec(); //OJO!!!
}
示例6: qbboundary
//
// qbboundary - set the elements on the boundary
//
double GeometricFlow::qbboundary( double x, double y, double z,
const AtomList& atomList )
{
double vbdn = 0;
for (size_t a = 0; a < atomList.size(); ++a) {
//
// vector from the current point (x_{g}) to the atom
// (x_{i}}
//
double x_q = x - atomList.get(a).x(); //xyzr[a][1];
double y_q = y - atomList.get(a).y(); //xyzr[a][2];
double z_q = z - atomList.get(a).z(); //xyzr[a][3];
//std::cout << "atomList: "
// << atomList.get(a).x() << ", "
// << atomList.get(a).y() << ", "
// << atomList.get(a).z() << endl;
//std::cout << "x_q,y_q,z_q: " << x_q << ", "
// << y_q << ", " << z_q << std::endl;
double q_q = atomList.get(a).pqr(); //pqr[a];
//std::cout << "q_q: " << q_q << std::endl;
// distance, | x_{g} - x_{i} |
double rr = sqrt( dot(x_q, y_q, z_q) ); // distance from
vbdn += q_q/( m_sdie * rr );
//std::cout << "m_sdie: " << m_sdie << std::endl;
}
return vbdn;
}
示例7: renderAtom
void
MP4::Tag::saveNew(ByteVector data)
{
data = renderAtom("meta", ByteVector(4, '\0') +
renderAtom("hdlr", ByteVector(8, '\0') + ByteVector("mdirappl") +
ByteVector(9, '\0')) +
data + padIlst(data));
AtomList path = d->atoms->path("moov", "udta");
if(path.size() != 2) {
path = d->atoms->path("moov");
data = renderAtom("udta", data);
}
long offset = path.back()->offset + 8;
d->file->insert(data, offset, 0);
updateParents(path, data.size());
updateOffsets(data.size(), offset);
// Insert the newly created atoms into the tree to keep it up-to-date.
d->file->seek(offset);
path.back()->children.prepend(new Atom(d->file));
}
示例8:
void
MP4::Tag::updateParents(const AtomList &path, long delta, int ignore)
{
if(static_cast<int>(path.size()) <= ignore)
return;
AtomList::ConstIterator itEnd = path.end();
std::advance(itEnd, 0 - ignore);
for(AtomList::ConstIterator it = path.begin(); it != itEnd; ++it) {
d->file->seek((*it)->offset);
long size = d->file->readBlock(4).toUInt();
// 64-bit
if (size == 1) {
d->file->seek(4, File::Current); // Skip name
long long longSize = d->file->readBlock(8).toLongLong();
// Seek the offset of the 64-bit size
d->file->seek((*it)->offset + 8);
d->file->writeBlock(ByteVector::fromLongLong(longSize + delta));
}
// 32-bit
else {
d->file->seek((*it)->offset);
d->file->writeBlock(ByteVector::fromUInt(size + delta));
}
}
}
示例9: addAtoms
void Group::addAtoms(AtomList const& atoms)
{
AtomList::const_iterator atom;
for (atom = atoms.begin(); atom != atoms.end(); ++atom) {
(*atom)->setReferenceFrame(&m_frame);
m_atoms.append(*atom);
}
}
示例10: if
bool
MP4::Tag::save()
{
ByteVector data;
for(MP4::ItemMap::ConstIterator it = d->items.begin(); it != d->items.end(); ++it) {
const String name = it->first;
if(name.startsWith("----")) {
data.append(renderFreeForm(name, it->second));
}
else if(name == "trkn") {
data.append(renderIntPair(name.data(String::Latin1), it->second));
}
else if(name == "disk") {
data.append(renderIntPairNoTrailing(name.data(String::Latin1), it->second));
}
else if(name == "cpil" || name == "pgap" || name == "pcst" || name == "hdvd" ||
name == "shwm") {
data.append(renderBool(name.data(String::Latin1), it->second));
}
else if(name == "tmpo" || name == "rate" || name == "\251mvi" || name == "\251mvc") {
data.append(renderInt(name.data(String::Latin1), it->second));
}
else if(name == "tvsn" || name == "tves" || name == "cnID" ||
name == "sfID" || name == "atID" || name == "geID" ||
name == "cmID") {
data.append(renderUInt(name.data(String::Latin1), it->second));
}
else if(name == "plID") {
data.append(renderLongLong(name.data(String::Latin1), it->second));
}
else if(name == "stik" || name == "rtng" || name == "akID") {
data.append(renderByte(name.data(String::Latin1), it->second));
}
else if(name == "covr") {
data.append(renderCovr(name.data(String::Latin1), it->second));
}
else if(name == "purl" || name == "egid") {
data.append(renderText(name.data(String::Latin1), it->second, TypeImplicit));
}
else if(name.size() == 4){
data.append(renderText(name.data(String::Latin1), it->second));
}
else {
debug("MP4: Unknown item name \"" + name + "\"");
}
}
data = renderAtom("ilst", data);
AtomList path = d->atoms->path("moov", "udta", "meta", "ilst");
if(path.size() == 4) {
saveExisting(data, path);
}
else {
saveNew(data);
}
return true;
}
示例11: AtomList
AtomList AtomList::neighborhood(Atomo *a)
{
AtomList al = AtomList();
for (int i = 0; i < _size; i++) {
Atomo *b = &contents[i];
if (closeEnough(a, b))
al.add(*b);
}
return al;
}
示例12: hasEqualElementsExcludingLast
bool const ExtendedIdListItemSet::hasEqualElementsExcludingLast(ExtendedIdListItemSet &idListItemSet) {
AtomList localAtoms = this->allAtomsFlattened();
AtomList remoteAtoms = idListItemSet.allAtomsFlattened();
for (int i = 0; i < localAtoms.size() - 1; ++i) {
if (localAtoms[i] != remoteAtoms[i]) {
return false;
}
}
return true;
}
示例13: getWindowType
AtomList XfitMan::getWindowType(Window window) const
{
AtomList result;
unsigned long length, *data;
length=0;
if (!getWindowProperty(window, atom("_NET_WM_WINDOW_TYPE"), (Atom)AnyPropertyType, &length, (unsigned char**) &data))
return result;
for (unsigned int i = 0; i < length; i++)
result.append(data[i]);
XFree(data);
return result;
}
示例14: if
void
MP4::Tag::saveExisting(ByteVector data, const AtomList &path)
{
MP4::Atom *ilst = path[path.size() - 1];
long offset = ilst->offset;
long length = ilst->length;
MP4::Atom *meta = path[path.size() - 2];
AtomList::ConstIterator index = meta->children.find(ilst);
// check if there is an atom before 'ilst', and possibly use it as padding
if(index != meta->children.begin()) {
AtomList::ConstIterator prevIndex = index;
prevIndex--;
MP4::Atom *prev = *prevIndex;
if(prev->name == "free") {
offset = prev->offset;
length += prev->length;
}
}
// check if there is an atom after 'ilst', and possibly use it as padding
AtomList::ConstIterator nextIndex = index;
nextIndex++;
if(nextIndex != meta->children.end()) {
MP4::Atom *next = *nextIndex;
if(next->name == "free") {
length += next->length;
}
}
long delta = data.size() - length;
if(delta > 0 || (delta < 0 && delta > -8)) {
data.append(padIlst(data));
delta = data.size() - length;
}
else if(delta < 0) {
data.append(padIlst(data, -delta - 8));
delta = 0;
}
d->file->insert(data, offset, length);
if(delta) {
updateParents(path, delta, 1);
updateOffsets(delta, offset);
}
}
示例15: renderAtom
void MP4::Tag::saveNew(ByteVector &data)
{
data = renderAtom( "meta", TagLib::ByteVector(4, '\0') +
renderAtom( "hdlr", TagLib::ByteVector(8, '\0') + TagLib::ByteVector("mdirappl") + TagLib::ByteVector(9, '\0') ) +
data + padIlst(data) );
AtomList path = d->atoms->path("moov", "udta");
if ( path.size() != 2 ) {
path = d->atoms->path("moov");
data = renderAtom("udta", data);
}
long offset = path[path.size() - 1]->offset + 8;
d->file->insert(data, offset, 0);
updateParents( path, data.size() );
updateOffsets(data.size(), offset);
}