Ejemplo n.º 1
0
void Inspector::retranslate()
      {
      setWindowTitle(tr("Inspector"));
      sa->setAccessibleName(tr("Inspector Subwindow"));
      QList<Element*> el = _el;
      setElements(QList<Element*>());
      setElements(el);
      }
Ejemplo n.º 2
0
MeshLib::NodePartitionedMesh* NodePartitionedMeshReader::readBinary(
    const std::string &file_name_base)
{
    //----------------------------------------------------------------------------------
    // Read headers
    const std::string fname_header = file_name_base +  "_partitioned_msh_";
    const std::string fname_num_p_ext = std::to_string(_mpi_comm_size) + ".bin";

    if (!readBinaryDataFromFile(fname_header + "cfg" + fname_num_p_ext,
        static_cast<MPI_Offset>(
            static_cast<unsigned>(_mpi_rank) * sizeof(_mesh_info)),
        MPI_LONG, _mesh_info))
        return nullptr;

    //----------------------------------------------------------------------------------
    // Read Nodes
    std::vector<NodeData> nodes(_mesh_info.nodes);

    if (!readBinaryDataFromFile(fname_header + "nod" + fname_num_p_ext,
        static_cast<MPI_Offset>(_mesh_info.offset[2]), _mpi_node_type, nodes))
        return nullptr;

    std::vector<MeshLib::Node*> mesh_nodes;
    std::vector<unsigned long> glb_node_ids;
    setNodes(nodes, mesh_nodes, glb_node_ids);

    //----------------------------------------------------------------------------------
    // Read non-ghost elements
    std::vector<unsigned long> elem_data(
        _mesh_info.regular_elements + _mesh_info.offset[0]);
    if (!readBinaryDataFromFile(fname_header + "ele" + fname_num_p_ext,
        static_cast<MPI_Offset>(_mesh_info.offset[3]), MPI_LONG, elem_data))
        return nullptr;

    std::vector<MeshLib::Element*> mesh_elems(
        _mesh_info.regular_elements + _mesh_info.ghost_elements);
    setElements(mesh_nodes, elem_data, mesh_elems);

    //----------------------------------------------------------------------------------
    //Read ghost element
    std::vector<unsigned long> ghost_elem_data(
        _mesh_info.ghost_elements + _mesh_info.offset[1]);

    if (!readBinaryDataFromFile(fname_header + "ele_g" + fname_num_p_ext,
        static_cast<MPI_Offset>(_mesh_info.offset[4]), MPI_LONG, ghost_elem_data))
        return nullptr;

    const bool process_ghost = true;
    setElements(mesh_nodes, ghost_elem_data, mesh_elems, process_ghost);

    //----------------------------------------------------------------------------------
    return newMesh(BaseLib::extractBaseName(file_name_base),
               mesh_nodes, glb_node_ids, mesh_elems);
}
Ejemplo n.º 3
0
void Inspector::setElement(Element* e)
      {
      QList<Element*> el;
      if (e)
            el.append(e);
      setElements(el);
      }
Ejemplo n.º 4
0
void Environment::xmlConfigure(xmlNode *fNode)
{
  int fEmbeddedSkin = 0;
  while (fNode) {
    if (!strcmp((char *) fNode->name, "Menu")) {
      SubMenuNode *t = new SubMenuNode();
      t->xmlConfigure(fNode->children);
      setTopMenu(t);
      setCurrentMenu(t);
    } else if (!strcmp((char *) fNode->name, "Resources")) {
      Resources *t = new Resources();
      t->xmlConfigure(fNode->children);
      setResources(t);
      fEmbeddedSkin = 1;
    } else if (!strcmp((char *) fNode->name, "Elements")) {
      Elements *t = new Elements();
      t->xmlConfigure(fNode->children);
      setElements(t);
      fEmbeddedSkin = 1;
    } else if (!strcmp((char *) fNode->name, "Dialog")) {
      Generic *t = new Generic();
      t->xmlConfigure(fNode->children);
      setDialog(t);
    } else if (!strcmp((char *) fNode->name, "LogFile")) {
      setLogFileName((char *) fNode->children->content);
    }
    fNode = fNode->next;
  }
  if (fEmbeddedSkin) {
    mResources->loadResources();
    mElements->associateResources(mResources);
  }
}
Ejemplo n.º 5
0
int Environment::loadSkin(char *fSkinDirectory)
{

  Elements *fOldElements = mElements;
  Resources *fOldResources = mResources;

  struct stat sbuf;

  char buf[255];
  sprintf(buf, "%sskin.xml", fSkinDirectory);

  printf("Loading %s\n", buf);
  if (stat(buf, &sbuf)) {
    return 0;
  }

  xmlDoc *theDoc = 0;
  xmlNode *theRoot = 0;

  theDoc = xmlReadFile(buf, NULL, 0);
  if (theDoc == NULL) {
    return 0;
  }

  theRoot = xmlDocGetRootElement(theDoc);

  xmlNode *fNode = theRoot->children;

  while (fNode) {
    if (!strcmp((char *) fNode->name, "Resources") && fNode->children) {
      Resources *t = new Resources();
      t->xmlConfigure(fNode->children);
      setResources(t);
    } else if (!strcmp((char *) fNode->name, "Elements") && fNode->children) {
      Elements *t = new Elements();
      t->xmlConfigure(fNode->children);
      setElements(t);
    }
    fNode = fNode->next;
  }

  if (fOldElements != mElements && fOldElements) {
    delete fOldElements;
  }
  if (fOldResources != mResources && fOldResources) {
    delete fOldResources;
  }

  setSkinPath(fSkinDirectory);

  debugPrint("     Loading resources\n");

  mResources->loadResources();
  debugPrint("     Associating resources & elements\n");

  mElements->associateResources(mResources);

  xmlFreeDoc(theDoc);
  return 1;
}
Ejemplo n.º 6
0
MouseMovementManager::MouseMovementManager(QList<qReal::Id> elements, qReal::EditorManager * editorManager,
		GesturesPainterInterface *gesturesPaintManager)
{
	mGesturesManager = new MixedGesturesManager();
	mKeyManager = &mKeyStringManager;
	mEditorManager = editorManager;
	mGesturesPaintMan = gesturesPaintManager;
	setElements(elements);
}
Ejemplo n.º 7
0
void Inspector::setElement(Element* e)
      {
      if (e)
printf("setElement %s\n", e->name());
      QList<Element*> el;
      if (e)
            el.append(e);
      setElements(el);
      }
Ejemplo n.º 8
0
ScrollPane<T>::ScrollPane(int x, int y, int width, int height, const std::vector<T> &e, const TextParams *font)
	: x(x), y(y), width(width), height(height), scrollPos(0), font(font)
{
	selection = -1;
	TTF_SizeText(font->font, "Test", NULL, &lineHeight);
	lines = height/lineHeight;
	setElements(e);
	lastClickTime = 0;
	lastClickIndex = -1;
}
Ejemplo n.º 9
0
TriangleSoup::TriangleSoup(std::vector<unsigned int> elements, Positions usePositions,
                           TextureCoordinates useTextures, Normals useNormals)
    : _vaoID(0)
    , _vertexBufferID(0)
    , _elementBufferID(0)
    , _useVertexPositions(usePositions)
    , _useTextureCoordinates(useTextures)
    , _useVertexNormals(useNormals)
{
    setElements(elements);
}
Ejemplo n.º 10
0
AMBasicXRFDetectorInfo& AMBasicXRFDetectorInfo::operator =(const AMBasicXRFDetectorInfo &other)
{
	if(this != &other){
		AMOldDetectorInfo::operator =(other);
		setElements(other.elements());
		setChannels(other.channels());
		setIntegrationTime(other.integrationTime());
		setPeakingTime(other.peakingTime());
	}
	return *this;
}
Ejemplo n.º 11
0
/*!
 * Update field information using VTKFieldMetaData class
 */
void VTKField::importMetaData( const VTKFieldMetaData &data){ 

    if( data.getSize() != -1 ){
        setDataType( VTKTypes::whichType(data.getType()) );

        if( getFieldType() == VTKFieldType::SCALAR ){
            setElements( data.getSize() ) ;

        } else if (getFieldType() == VTKFieldType::VECTOR) {
            setElements( data.getSize() /3 ) ;

        } else if (getFieldType() == VTKFieldType::CONSTANT) {
            setElements( data.getSize() / components  );

        } else if (getFieldType() == VTKFieldType::VARIABLE) {
            setElements( data.getSize() );
        }

    };

    return ;
};
Ejemplo n.º 12
0
ExtensionNSHandler::ExtensionNSHandler (
			const XalanDOMString& namespaceUri,
			const XalanDOMString& elemNames,
			const XalanDOMString& funcNames,
			const XalanDOMString& lang,
			const XalanDOMString& srcURL,
			const XalanDOMString& src) :
	ExtensionFunctionHandler(namespaceUri, funcNames, lang, srcURL, src),
	m_elements(),
	m_componentDescLoaded(true)
		 
{
	setElements(elemNames);
}