Esempio n. 1
0
	void visit_children(Visitor & visitor,unsigned int parent,Tree * tree)
	{
		auto it = child_table.find(parent);
		if (it == child_table.end())
			return;
		std::vector<unsigned int> & children = it->second;
		unsigned int properties = 0;
		//Skip any properties if the structure has any
		//if (parent != 0 && commands[parent - 1].type == detail::Command::kStructure) properties = commands[parent - 1].payload.structure_.properties;
		for (unsigned int i = properties; i < children.size(); i++)
		{
			unsigned int index = children[i];
			detail::Command & child = commands[index];
			Object o(tree, index);
			switch (child.type)
			{

			case detail::Command::kDataArray:
				visitor.visit(DataArrayList(o));
				break;
			case detail::Command::kDataList:
				visitor.visit(DataList(o));
				break;
			case detail::Command::kStructure:
				visitor.visit(Structure(o));
				break;
			default:
				break;
			}
		}
	}
Esempio n. 2
0
 static DataList convolve(const DataList &f1, const DataList &f2,
                                 const float dt = 1.0f) {
   const unsigned int f1size = f1.size();
   const unsigned int f2size = f2.size();
   DataList toReturn = DataList(f1size + f2size - 1, 0);
   for (unsigned int i = 0; i < f1size; ++i) {
     for (unsigned int j = 0; j < f2size; ++j) {
       toReturn[i+j] += f1[i] * f2[j] * dt;
     }
   }
   return toReturn;
 }