int deleteEntryFromIntIndex(GLMDB_env *glmdb_env, MDB_txn *mdbTxn, MDB_cursor *vertexCursor, MDB_cursor *intIndexCursor,
		long long elementId, int propertyKeyId) {

	int rc;

	//Get the old value first
	MDB_val oldData;
	MDB_val key, data;
	rc = getVertexProperty(vertexCursor, elementId, propertyKeyId, &oldData);
	if (rc == 0) {
		//Delete the current indexed element
		IntIndexKeyStruct *intIndexKeyStruct = malloc(sizeof(IntIndexKeyStruct));
		intIndexKeyStruct->propertyKeyId = propertyKeyId;
		intIndexKeyStruct->elementId = elementId;
		intIndexKeyStruct->value = *((int *) oldData.mv_data);
		key.mv_size = sizeof(IntIndexKeyStruct);
		key.mv_data = intIndexKeyStruct;
		rc = mdb_cursor_get(intIndexCursor, &key, &data, MDB_SET_KEY);
		if (rc != 0) {
			free(intIndexKeyStruct);
			goto fail;
		}
		free(intIndexKeyStruct);
		rc = mdb_cursor_del(intIndexCursor, 0);
	}

	fail: return rc;
}
	    std::vector<Vertex> getVerticesProperties(std::vector<BGLVertex> bglVertices){
		std::vector<Vertex> vertices;
		for(BGLVertex v : bglVertices){
		    vertices.push_back(getVertexProperty(v));
		}
		return vertices;
	    }
Example #3
0
 std::shared_ptr<Geometry3D> addGeometry3D(const T& geom, Scope s = Scope::Local) {
     
     auto g = m_system->addGeometry3D(geom);
     
     //we need to transfer the geometry to our cluster
     auto cluster = std::static_pointer_cast<typename Final::Graph>(m_system->getGraph());
     auto globalVertex = g->getVertexProperty();
     //it may be a sub-sub cluster etc.
     auto localVertex = cluster->getLocalVertex(globalVertex);
     dcm_assert(localVertex.second);
     cluster->moveToSubcluster(localVertex.first, getVertexProperty());    
     
     //store the scope and geometry for later transformations
     m_geometries.push_back(std::make_pair(g, s));
     
     return g;
 };
Example #4
0
 /**
  * @brief Set the content and stores the user type
  * 
  * This function is used to set the content of the Part3D container. It extract the contents of 
  * the given user Type and stores it in an accessible manner for the solver. Furhtermore it stores
  * the supplied user type for later access. The exact behaviour of this feature depends on the specified
  * qualifiers of the storable types as given as the Module3D template arguments. If the type was given
  * without any special qualifiers then a copy of the given user type is strored.
 */
 void set(const Type& part) {
     //store the type
     m_type = part;
     m_isSet  = true;
     
     // we were not able to set the GraphObject before, as shared_from_this was not available in the constructor
     std::shared_ptr<typename Final::Graph> cluster = std::static_pointer_cast<typename Final::Graph>(m_system->getGraph());
     auto res = cluster->getLocalVertexGraph(getVertexProperty()); //fusion::vector<LocalVertex, std::shared_ptr<ClusterGraph>, bool>
     dcm_assert(fusion::at_c<2>(res));
     fusion::at_c<1>(res)->template setProperty<details::GraphObjectProperty>(fusion::at_c<0>(res), Inherited::shared_from_this());
 };
	    /**
	     * @brief Returns all incoming edges to *targetVertex* paired with its source vertex.
	     *
	     */
	    std::vector<std::pair<Vertex, Edge> > getInEdges(const Vertex targetVertex){
		InEdgeIter ei, ei_end;
		std::tie(ei, ei_end) = boost::in_edges((*graph).global_to_local(targetVertex.id), (*graph));
		std::vector<BGLEdge> bglInEdges(ei, ei_end);

		std::vector<std::pair<Vertex, Edge> > inEdges;
		for(BGLEdge e : bglInEdges){
		    BGLVertex source = getEdgeSource(e);
		    Vertex vertex    = getVertexProperty(source);
		    Edge edge        = getEdge(e);
		    inEdges.push_back(std::make_pair(vertex, edge));
		}
		return inEdges;
	    }
	    /**
	     * @brief Returns all outgoing edges of *srcVertex* paired with its target vertex.
	     *
	     */
	    std::vector<std::pair<Vertex, Edge> > getOutEdges(const Vertex srcVertex){
		OutEdgeIter ei, ei_end;
		std::tie(ei, ei_end) = boost::out_edges((*graph).global_to_local(srcVertex.id), (*graph));
		std::vector<BGLEdge> bglOutEdges(ei, ei_end);

		std::vector<std::pair<Vertex, Edge> > outEdges;
		for(BGLEdge e : bglOutEdges){
		    BGLVertex target = getEdgeTarget(e);
		    Vertex vertex    = getVertexProperty(target);
		    Edge   edge      = getEdge(e);
		    outEdges.push_back(std::make_pair(vertex, edge));
		}
		return outEdges;
	    }