Ejemplo n.º 1
0
Assembly::Assembly(SystemBase & sys, CouplingMatrix * & cm, THREAD_ID tid) :
    _sys(sys),
    _cm(cm),
    _dof_map(_sys.dofMap()),
    _tid(tid),
    _mesh(sys.mesh()),
    _mesh_dimension(_mesh.dimension()),
    _current_qrule(NULL),
    _current_qrule_volume(NULL),
    _current_qrule_arbitrary(NULL),
    _current_qrule_face(NULL),
    _current_qface_arbitrary(NULL),
    _current_qrule_neighbor(NULL),

    _current_elem(NULL),
    _current_side(0),
    _current_side_elem(NULL),
    _current_neighbor_elem(NULL),
    _current_neighbor_side(0),
    _current_node(NULL),
    _current_neighbor_node(NULL),

    _should_use_fe_cache(false),
    _currently_fe_caching(true),

    _cached_residual_values(2), // The 2 is for TIME and NONTIME
    _cached_residual_rows(2), // The 2 is for TIME and NONTIME

    _max_cached_residuals(0),
    _max_cached_jacobians(0),
    _block_diagonal_matrix(false)
{
  // Build fe's for the helpers
  getFE(FEType(FIRST, LAGRANGE));
  getFEFace(FEType(FIRST, LAGRANGE));

  // Build an FE helper object for this type for each dimension up to the dimension of the current mesh
  for(unsigned int dim=1; dim<=_mesh_dimension; dim++)
  {
    _holder_fe_helper[dim] = &_fe[dim][FEType(FIRST, LAGRANGE)];
    (*_holder_fe_helper[dim])->get_phi();
    (*_holder_fe_helper[dim])->get_dphi();
    (*_holder_fe_helper[dim])->get_xyz();
    (*_holder_fe_helper[dim])->get_JxW();

    _holder_fe_face_helper[dim] = &_fe_face[dim][FEType(FIRST, LAGRANGE)];
    (*_holder_fe_face_helper[dim])->get_phi();
    (*_holder_fe_face_helper[dim])->get_dphi();
    (*_holder_fe_face_helper[dim])->get_xyz();
    (*_holder_fe_face_helper[dim])->get_JxW();
    (*_holder_fe_face_helper[dim])->get_normals();
  }
}
Ejemplo n.º 2
0
// FIXME
bool CFEManager::haveFreeFrontend()
{
	if(have_locked) {
		CFrontend * fe = getFE(0);
		if((mode == FE_MODE_TWIN) || (fe->getInfo()->type != FE_QPSK)) {
			for(fe_map_iterator_t it = femap.begin(); it != femap.end(); it++) {
				fe = it->second;
				INFO("check %d: locked %d", fe->fenumber, fe->Locked());
				if(!fe->Locked())
					return true;
			}
		}
		return false;
	}
	return true;
}
Ejemplo n.º 3
0
// load services
int loadServices(bool only_current)
{
	xmlDocPtr parser;
	scnt = 0;

	dprintf(DEBUG_NORMAL, "getServices:loadServices:\n");

	if(only_current)
		goto do_current;

	// parse services.xml
	parser = parseXmlFile(SERVICES_XML);

	if (parser != NULL) 
	{
		xmlNodePtr search = xmlDocGetRootElement(parser)->xmlChildrenNode;

		while (search) 
		{
			if (!(strcmp(xmlGetName(search), "sat"))) 
			{
				// position
				t_satellite_position position = xmlGetSignedNumericAttribute(search, "position", 10);
				char * name = xmlGetAttribute(search, "name");

				if(satellitePositions.find(position) == satellitePositions.end()) 
				{
					init_sat(position);
							
					satellitePositions[position].name = name;
				}
			}

			// jump to the next node
			search = search->xmlNextNode;
		}

		FindTransponder( xmlDocGetRootElement(parser)->xmlChildrenNode );
		
		xmlFreeDoc(parser);
	}

	// load motor position
	for(int i = 0; i < FrontendCount; i++)
	{
		if( getFE(i)->getInfo()->type == FE_QPSK)
		{
			loadMotorPositions();
			break;
		}
	}

	dprintf(DEBUG_NORMAL, "[zapit] %d services loaded (%d)...\n", scnt, allchans.size());

do_current:
	dprintf(DEBUG_DEBUG, "loading current services\n");

	if (scanSDT && (parser = parseXmlFile(CURRENTSERVICES_XML))) 
	{
		newfound = 0;
		
		dprintf(DEBUG_INFO, "[getservices] " CURRENTSERVICES_XML "  found.\n");
		
		FindTransponder( xmlDocGetRootElement(parser)->xmlChildrenNode );
		
		xmlFreeDoc(parser);
		unlink(CURRENTSERVICES_XML);
		
		if(newfound)
			SaveServices(true); //FIXME for second tuner
	}

	if(!only_current) 
	{
		parser = parseXmlFile(MYSERVICES_XML);
		if (parser != NULL) 
		{
			FindTransponder(xmlDocGetRootElement(parser)->xmlChildrenNode);
			
			xmlFreeDoc(parser);
		}
	}

	return 0;
}
Ejemplo n.º 4
0
// load transponders
int loadTransponders()
{
	bool satcleared = 0;
	scnt = 0;
	
	t_satellite_position position = 0; //first postion

	dprintf(DEBUG_NORMAL, "getServices:loadTransponders:\n");
	
	select_transponders.clear();
	fake_tid = fake_nid = 0;
	
	if(!satcleared)
		satellitePositions.clear();

	satcleared = 1;

	fe_type_t fe_type = FE_QAM;

	// parse sat tp
	for(int i = 0; i < FrontendCount; i++)
	{
		CFrontend * fe = getFE(i);
		fe_type = fe->getInfo()->type;

		//parseScanInputXml(i);
		parseScanInputXml(fe_type);
			
		if ( scanInputParser != NULL ) 
		{
			xmlNodePtr search = xmlDocGetRootElement(scanInputParser)->xmlChildrenNode;

			while (search) 
			{
				if (!(strcmp(xmlGetName(search), "sat"))) 
				{
					// position
					position = xmlGetSignedNumericAttribute(search, "position", 10);
					
					char * name = xmlGetAttribute(search, "name");

					if(satellitePositions.find(position) == satellitePositions.end()) 
					{
						init_sat(position);
					}

					// name
					satellitePositions[position].name = name;
					
					// type
					satellitePositions[position].type = DVB_S;
				}
				else if(!(strcmp(xmlGetName(search), "cable"))) 
				{
					//flags ???
					//satfeed ???
					
					char * name = xmlGetAttribute(search, "name");

					if(satellitePositions.find(position) == satellitePositions.end()) 
					{
						init_sat(position);
					}

					// name
					satellitePositions[position].name = name;
					
					// type //needed to resort list for scan menue
					satellitePositions[position].type = DVB_C;
				}
				else if(!(strcmp(xmlGetName(search), "terrestrial"))) 
				{
					char * name = xmlGetAttribute(search, "name");

					if(satellitePositions.find(position) == satellitePositions.end()) 
					{
						init_sat(position);
					}

					// name
					satellitePositions[position].name = name;
					
					// type //needed to resort list for scan menue
					satellitePositions[position].type = DVB_T;
				}

				// parse sat TP
				ParseSatTransponders(fe_type, search, position);
				
				position++;
				
				search = search->xmlNextNode;
			}
		}
	}

	// satip
	if(g_settings.satip_allow_satip)
	{
		if(g_settings.satip_serverbox_type == DVB_C)
			fe_type = FE_QAM;
		else if(g_settings.satip_serverbox_type == DVB_S)
			fe_type = FE_QPSK;
		else if(g_settings.satip_serverbox_type == DVB_T)
			fe_type = FE_OFDM;

		parseScanInputXml(fe_type);
			
		if ( scanInputParser != NULL ) 
		{
			xmlNodePtr search = xmlDocGetRootElement(scanInputParser)->xmlChildrenNode;

			while (search) 
			{
				if (!(strcmp(xmlGetName(search), "sat"))) 
				{
					// position
					position = xmlGetSignedNumericAttribute(search, "position", 10);
					
					char * name = xmlGetAttribute(search, "name");

					if(satellitePositions.find(position) == satellitePositions.end()) 
					{
						init_sat(position);
					}

					// name
					satellitePositions[position].name = name;
					
					// type
					satellitePositions[position].type = DVB_S;
				}
				else if(!(strcmp(xmlGetName(search), "cable"))) 
				{
					//flags ???
					//satfeed ???
					
					char * name = xmlGetAttribute(search, "name");

					if(satellitePositions.find(position) == satellitePositions.end()) 
					{
						init_sat(position);
					}

					// name
					satellitePositions[position].name = name;
					
					// type //needed to resort list for scan menue
					satellitePositions[position].type = DVB_C;
				}
				else if(!(strcmp(xmlGetName(search), "terrestrial"))) 
				{
					char * name = xmlGetAttribute(search, "name");

					if(satellitePositions.find(position) == satellitePositions.end()) 
					{
						init_sat(position);
					}

					// name
					satellitePositions[position].name = name;
					
					// type //needed to resort list for scan menue
					satellitePositions[position].type = DVB_T;
				}

				// parse sat TP
				ParseSatTransponders(fe_type, search, position);
				
				position++;
				
				search = search->xmlNextNode;
			}
		}	
	}
	
	return 0;
}	
Ejemplo n.º 5
0
// scan services.xml
void FindTransponder(xmlNodePtr search)
{
	t_satellite_position satellitePosition = 0;
	uint8_t Source;
	newtpid = 0xC000;
	
	bool have_s = false;
	bool have_c = false;
	bool have_t = false;
	
	// frontend type
	for(int i = 0; i < FrontendCount; i++)
	{
		CFrontend * fe = getFE(i);
		
		if( fe->getDeliverySystem() == DVB_S ) 
			have_s = true;
		if( fe->getDeliverySystem() == DVB_C ) 
			have_c = true;
		if( fe->getDeliverySystem() == DVB_T ) 
			have_t = true;
	}

	// satip
	if(g_settings.satip_allow_satip)
	{
		if(g_settings.satip_serverbox_type == DVB_C)
			have_c = true;
		else if(g_settings.satip_serverbox_type == DVB_S)
			have_s = true;
		else if(g_settings.satip_serverbox_type == DVB_T)
			have_t = true;
	}
	
	
	while (search) 
	{
		if ( !(strcmp(xmlGetName(search), "cable")) && have_c)
		{
			Source = DVB_C;
			
			for (sat_iterator_t spos_it = satellitePositions.begin(); spos_it != satellitePositions.end(); spos_it++) 
			{
				if( !strcmp(spos_it->second.name.c_str(), xmlGetAttribute(search, "name")) ) 
				{
					satellitePosition = spos_it->first;
					break;
				}
			}
			
			dprintf(DEBUG_NORMAL, "getservices:FindTransponder: going to parse dvb-%c provider %s\n", xmlGetName(search)[0], xmlGetAttribute(search, "name"));
		}
		else if ( !(strcmp(xmlGetName(search), "terrestrial")) && have_t)
		{
			Source = DVB_T;
			
			for (sat_iterator_t spos_it = satellitePositions.begin(); spos_it != satellitePositions.end(); spos_it++) 
			{
				if( !strcmp(spos_it->second.name.c_str(), xmlGetAttribute(search, "name")) ) 
				{
					satellitePosition = spos_it->first;
					break;
				}
			}
			
			dprintf(DEBUG_NORMAL, "getservices:FindTransponder: going to parse dvb-%c provider %s\n", xmlGetName(search)[0], xmlGetAttribute(search, "name"));
		}
		else if ( !(strcmp(xmlGetName(search), "sat")) && have_s) 
		{
			Source = DVB_S;
			satellitePosition = xmlGetSignedNumericAttribute(search, "position", 10);
			
			dprintf(DEBUG_NORMAL, "getservices:FindTransponder: going to parse dvb-%c provider %s position %d\n", xmlGetName(search)[0], xmlGetAttribute(search, "name"), satellitePosition);
		}
		else // unknow
		{
			search = search->xmlNextNode;
			continue;
		}
		
		// parse TP
		ParseTransponders(search->xmlChildrenNode, satellitePosition, Source );

		newfound++;
		
		search = search->xmlNextNode;
	}
}
Ejemplo n.º 6
0
void FormanGradientVector::ascending_1cells_extraction(bool with_geometry){


    vector<bool> visited = vector<bool>(mesh->getTopSimplexesNum(),false);
    map<int,int> visited_triangle;
    set<pair<Vertex3D,Vertex3D> > edges;

    for(int i=0; i<mesh->getTopSimplexesNum(); i++){
        visited[i]=true;
        for(int j=0; j<3; j++){
            if(mesh->getTopSimplex(i).TT(j) == -1 || !visited[mesh->getTopSimplex(i).TT(j)]){

                queue<int> coda;
                Edge* edge = mesh->getTopSimplex(i).TE(j);
                if(is_edge_critical(edge->EV(0), edge->EV(1))){

                    vector<int> et = mesh->ET(*edge);
                    for(int j=0; j<et.size(); j++){
                        coda.push(et[j]);
                    }

                    while(!coda.empty()){

                        int t = coda.front();
                        coda.pop();

                        visited_triangle[t]=i;

                        if(is_face_critical(t)){
                            //here critical face
                        }
                        else{
                            int e = getFE(t);

                            int t_adj = mesh->getTopSimplex(t).TT(e);
                            if(t_adj != -1){
                                coda.push(t_adj);



                                Vertex3D v1 = mesh->getVertex(mesh->getTopSimplex(t_adj).TV(0));
                                v1 += mesh->getVertex(mesh->getTopSimplex(t_adj).TV(1));
                                v1 += mesh->getVertex(mesh->getTopSimplex(t_adj).TV(2));
                                v1 /= 3.0;

                                Edge* edg = mesh->getTopSimplex(t).TE(e);
                                Vertex3D ve = mesh->getVertex(edg->EV(0));
                                ve += mesh->getVertex(edg->EV(1));
                                ve /= 2.0;


                                Vertex3D v2 = mesh->getVertex(mesh->getTopSimplex(t).TV(0));
                                v2 += mesh->getVertex(mesh->getTopSimplex(t).TV(1));
                                v2 += mesh->getVertex(mesh->getTopSimplex(t).TV(2));
                                v2 /= 3.0;

                                edges.insert(pair<Vertex3D,Vertex3D>(v1,ve));
                                edges.insert(pair<Vertex3D,Vertex3D>(v2,ve));
                            }
                        }
                    }

                }
            }
        }
    }

    if(with_geometry)
        writeVTK_1cells("ascending1cells.vtk",edges);
}
Ejemplo n.º 7
0
int parse_nit(t_satellite_position satellitePosition, freq_id_t freq, int feindex)
{
	int ret = 0;
	int secdone[255];
	int sectotal = -1;

	memset(secdone, 0, 255);
	
	dprintf(DEBUG_NORMAL, "%s\n", __FUNCTION__);
	
	cDemux * dmx = new cDemux();
	
#if defined (PLATFORM_COOLSTREAM)
	dmx->Open(DMX_PSI_CHANNEL);
#else	
	dmx->Open(DMX_PSI_CHANNEL, NIT_SIZE, getFE(feindex));
#endif	

	unsigned char buffer[NIT_SIZE];

	/* position in buffer */
	unsigned short pos;
	unsigned short pos2;

	/* network_information_section elements */
	unsigned short section_length;
	unsigned short network_descriptors_length;
	unsigned short transport_descriptors_length;
	unsigned short transport_stream_loop_length;
	t_transport_stream_id transport_stream_id;
	t_original_network_id original_network_id;
	unsigned short network_id;

	unsigned char filter[DMX_FILTER_SIZE];
	unsigned char mask[DMX_FILTER_SIZE];

	memset(filter, 0x00, DMX_FILTER_SIZE);
	memset(mask, 0x00, DMX_FILTER_SIZE);

	filter[0] = 0x40;	/* nit tid */
	mask[0] = 0xFF;

	if (dmx->sectionFilter(0x10, filter, mask, 5) < 0) 
	{
		delete dmx;
		return -1;
	}

	do {
		if (dmx->Read(buffer, NIT_SIZE) < 0) 
		{
			dprintf(DEBUG_NORMAL, "parse_nit: dmx read failed\n");
			
			delete dmx;
			return -1;
		}

		if(buffer[0] != 0x40)
			printf("parse_nit: Bogus section received: 0x%x\n", buffer[0]);

		section_length = ((buffer[1] & 0x0F) << 8) + buffer[2];
		network_id = ((buffer[3] << 8)| buffer [4]);
		network_descriptors_length = ((buffer[8] & 0x0F) << 8) | buffer[9];
		unsigned char secnum = buffer[6];
		
		dprintf(DEBUG_NORMAL, "parse_nit: section 0x%x last 0x%x network_id 0x%x -> %s\n", secnum, buffer[7], network_id, secdone[secnum] ? "skip" : "use");

		if(secdone[secnum]) // mark sec XX done
			continue;

		secdone[secnum] = 1;
		sectotal++;

		for (pos = 10; pos < network_descriptors_length + 10; pos += buffer[pos + 1] + 2)
		{
			switch (buffer[pos])
			{
				/*case 0x0F:
					Private_data_indicator_descriptor(buffer + pos);
					break;*/

				case 0x40:
					network_name_descriptor(buffer + pos);
					break;

				case 0x4A:
					linkage_descriptor(buffer + pos);
					break;

				case 0x5B:
					multilingual_network_name_descriptor(buffer + pos);
					break;

				/*case 0x5F:
					private_data_specifier_descriptor(buffer + pos);
					break;*/

				case 0x80: /* unknown, Eutelsat 13.0E */
					break;

				case 0x90: /* unknown, Eutelsat 13.0E */
					break;

				default:
					dprintf(DEBUG_DEBUG, "parse_nit: first_descriptor_tag: %02x\n", buffer[pos]);
					break;
			}
		}

		transport_stream_loop_length = ((buffer[pos] & 0x0F) << 8) | buffer[pos + 1];

		if (!transport_stream_loop_length)
			continue;

		for (pos += 2; pos < section_length - 3; pos += transport_descriptors_length + 6)
		{
			transport_stream_id = (buffer[pos] << 8) | buffer[pos + 1];
			original_network_id = (buffer[pos + 2] << 8) | buffer[pos + 3];
			transport_descriptors_length = ((buffer[pos + 4] & 0x0F) << 8) | buffer[pos + 5];

			//if (transponders.find((transport_stream_id << 16) | original_network_id) == transponders.end())
			//if (scantransponders.find(CREATE_TRANSPONDER_ID_FROM_SATELLITEPOSITION_ORIGINALNETWORK_TRANSPORTSTREAM_ID(freq, satellitePosition, original_network_id, transport_stream_id)) == scantransponders.end())
			{
				for (pos2 = pos + 6; pos2 < pos + transport_descriptors_length + 6; pos2 += buffer[pos2 + 1] + 2)
				{
					switch (buffer[pos2])
					{
						case 0x41:
							service_list_descriptor(buffer + pos2, transport_stream_id, original_network_id, satellitePosition, freq);
							break;

						case 0x42:
							stuffing_descriptor(buffer + pos2);
							break;

						case 0x43:
							if (satellite_delivery_system_descriptor(buffer + pos2, transport_stream_id, original_network_id, satellitePosition, freq, feindex) < 0)
							{
								ret = -2;
								goto _return;
							}
							break;

						case 0x44:
							if (cable_delivery_system_descriptor(buffer + pos2, transport_stream_id, original_network_id, satellitePosition, freq, feindex) < 0)
							{
								ret = -2;
								goto _return;
							}
							break;

						case 0x5A:
							if(terrestrial_delivery_system_descriptor(buffer + pos2, transport_stream_id, original_network_id, satellitePosition, freq, feindex) < 0)
							{
								ret = -2;
								goto _return;
							}
							break;

						case 0x5F:
							private_data_specifier_descriptor(buffer + pos2);
							break;

						case 0x62:
							frequency_list_descriptor(buffer + pos2);
							break;

						case 0x82: /* unknown, Eutelsat 13.0E */
							break;

						default:
							dprintf(DEBUG_DEBUG, "parse_nit: second_descriptor_tag: %02x\n", buffer[pos2]);
							break;
					}
				}
			}
		}
	} while(sectotal < buffer[7]);
	//} while (filter[4]++ != buffer[7]);

_return:
	delete dmx;
	
	return ret;
}