def _backend(self): """ Query function for the c++ backend object. """ if self.__backend is None: # Construct the c++ backend object. if self.__use_buckets: cpp_types = bucketListToStdVectorStdVectorString(self.__types) else: cpp_types = stringListToStdVectorStdVectorString(self.__types) cpp_coords = numpy2DArrayToStdVectorStdVectorDouble( self.__lattice.sites()) cpp_possible_types = Backend.StdMapStringInt(self.__possible_types) # Send in the coordinates and types to construct the backend configuration. self.__backend = Backend.Configuration(cpp_coords, cpp_types, cpp_possible_types) # Return the backend. return self.__backend
def _update(self): """ Query for the update info. :returns: The update stored on the class. """ if self.__cpp_update is None: # Create the cpp update vector of maps. self.__cpp_update = Backend.StdVectorStdMapStringInt() # Take each entry in the update list. for update_entry in self.__update: # Convert to C++ cpp_map = Backend.StdMapStringInt() for e in update_entry: cpp_map[e[1]] = e[0] # Add. self.__cpp_update.push_back(cpp_map) return self.__cpp_update
def _backend(self, possible_types): """ Query for the local configuration backend object. :param possible_types: A dict with the global mapping of type strings to integers. :returns: The interactions object in C++ """ if self.__backend is None: # Construct the c++ backend object. cpp_types = bucketListToStdVectorStdVectorString(self.__types) cpp_coords = numpy2DArrayToStdVectorStdVectorDouble(self.__coordinates) cpp_possible_types = Backend.StdMapStringInt(possible_types) # Send in the coordinates and types to construct the backend configuration. self.__backend = Backend.Configuration(cpp_coords, cpp_types, cpp_possible_types) # Return the backend. return self.__backend