Example #1
0
int main(int argc, char ** argv)/*{{{*/
{
	FILE * regfile;
	struct namelist * nls;
	struct dimension * dims;
	struct variable * vars;
	struct group_list * groups;
	struct package * pkgs;
	int err;

	if (argc != 2) {
		fprintf(stderr,"Reading registry file from standard input\n");
		regfile = stdin;
	}
	else if (!(regfile = fopen(argv[1], "r"))) {
		fprintf(stderr,"\nError: Could not open file %s for reading.\n\n", argv[1]);
		return 1;
	}   

	nls = NULL;
	dims = NULL;
	vars = NULL;

	ezxml_t registry = ezxml_parse_fp(regfile);

	// Cleanup registry structures
	err = push_attributes(registry);
	err = merge_structs_and_var_arrays(registry);
	err = merge_streams(registry);

	if (validate_reg_xml(registry)) {
		fprintf(stderr, "Validation failed.....\n");
		return 1;
	}

	write_model_variables(registry);

	if (parse_reg_xml(registry)) {
		fprintf(stderr, "Parsing failed.....\n");
		return 1;
	}

	return 0;
}/*}}}*/
Example #2
0
void STPConnection::propagate()
{
	if ( src->evolve_locally()) {
		push_attributes(); // stuffs all attributes into the SpikeDelays for sync
	}

	if ( dst->evolve_locally() ) { // necessary 

		if (src->get_spikes()->size()>0) {
			NeuronID * ind = w->get_row_begin(0); // first element of index array
			AurynWeight * data = w->get_data_begin();
			AttributeContainer::const_iterator attr = src->get_attributes()->begin();
			SpikeContainer::const_iterator spikes_end = src->get_spikes()->end();
			for (SpikeContainer::const_iterator spike = src->get_spikes()->begin() ;
					spike != spikes_end ; ++spike ) {
				for (NeuronID * c = w->get_row_begin(*spike) ; c != w->get_row_end(*spike) ; ++c ) {
					AurynWeight value = data[c-ind] * *attr; 
					transmit( *c , value );
				}
				++attr;
			}
		}
	}
}