Exemplo n.º 1
0
bool SubOutput::set_link()
{
  p = &fake_in; src_obj = nullptr; linkType = LinkBad;
  if( source.cval().isEmpty() ) {
    linkType = LinkNone;
    return true; // really?
  }

  if( !par ) {
    return false;
  }
  Scheme *sch = par->getObjT<Scheme*>( "sch" );
  if( !sch ) {
    qWarning() << "scheme not found " << NWHE;
    return false;
  }

  int lt;
  const LinkedObj *srct = nullptr;
  const double *cp = sch->getDoublePtr( source, &lt, &srct, 0 );
  if( lt == LinkElm || lt == LinkSpec ) {
    p = cp;  src_obj = srct; linkType = lt;
  } else {
    qWarning() << "ptr not found for output " << source << NWHE;
    return false;
  }
  return true;
}
Exemplo n.º 2
0
Relation Relation::combinator(Relation& right)
{
	Scheme temp;

	vector <pair<int,int> > at_relation;

	temp = my_values.combine_schemes(right.my_values, at_relation);

	Relation result; 

	for (int i = 0; i < temp.size(); i++)

		result.set_value(temp.at(i));

	for (set<Tuple>::iterator it = Tuple_Set.begin(); it != Tuple_Set.end(); ++it)

		for (set<Tuple>::iterator it2 = right.Tuple_Set.begin(); it2 != right.Tuple_Set.end(); ++it2)
		{
			Tuple t(*it);

			if (t.joinable((*it2), at_relation))
			{
				t = t.combinator((*it2), at_relation);

				result.set_tuple(t);
			}
		}
			return result;
}
Exemplo n.º 3
0
string Interpretter::outputFacts() {
    string out = "";
    // get a list of relations
    for (auto relation : db) {
        // print the relation
        out += relation.first + "\n";
        Scheme s = relation.second.getScheme();
        set <Tuple> t = relation.second.getTuples();
        
        // for each of the tuples in the relation's set
        for (auto tuple : t) {
            out += "  ";
            // for each of the attributes in the relation's scheme:
            for (int attr = 0; attr < s.size(); attr++) {
                // print the attribute
                out += s[attr] + "=";
                
                // print the value at the relation's tuple
                out += tuple[attr] + " ";
            }
            if (tuple.size() > 0) {
                out.pop_back();
            }
        out += "\n";
        }
    out += "\n";
    }
    return out;
}
Exemplo n.º 4
0
void Relation::project(map<int, string>& variables)
{
	set<Tuple> newTuples;
	Scheme newScheme;
	Tuple t;

	for (auto& v : variables){
		newScheme.addAttribute(scheme.getAttributes().at(v.first));
	}

	for (auto& tup : tuples){
		for (auto& v : variables)
		{
			t.addAttValue(tup.at(v.first));
		}
		if (variables.size() > 0){
			newTuples.insert(t);
			t.clear();
		}
	}

	tuples = newTuples;
	scheme = newScheme;
	setName("project");
}
Exemplo n.º 5
0
/*************************************************************************
	Loads a scheme
*************************************************************************/
Scheme* SchemeManager::loadScheme(const String& scheme_filename, const String& resourceGroup)
{
	Logger::getSingleton().logEvent((utf8*)"Attempting to load Scheme from file '" + scheme_filename + "'.");

	Scheme* tmp = new Scheme(scheme_filename, resourceGroup);
	String name = tmp->getName();
	d_schemes[name] = tmp;
	return tmp;
}
Exemplo n.º 6
0
void Relation::rename(map<int, string>& variables)
{
	Scheme newScheme;
	for (auto& v : variables){
		newScheme.addAttribute(v.second);
	}
	scheme = newScheme;
	setName("rename");
}
Exemplo n.º 7
0
//------------------------------------------------------------------//
// ---------------- LAPLACE -- CELL CENTER -------------------------//
//------------------------------------------------------------------//
// (1) The following function is the core others use this function  //
//------------------------------------------------------------------//
void Grid::triLaplace(triLinSys &axb, shared_ptr<Cell > f, double const &c) {
  if (!thisVar) {cout << "Laplace0: Variable is not locked!!"<< endl; return; }
  //  cout << "LAPLACE !!!! "<< endl; 
  //  cout << f->vol() << endl; 
  Scheme<double> sch = f->normGrad(thisVar); 
  auto area = f->vol().abs(); 
  int n = f->next; 
  int p = f->prev;
  for (auto i = 0; i < sch.size(); ++i) { 
    //    cout << "[" << n << ", "<< p << "] "<< c << " : " << sch.val[i] << " : " << area; 
    auto flux = c*sch.val[i]*area;
    //cout << " : " << flux << endl; 
    //cin.ignore().get(); 
    if (n >= 0) axb.A(n, sch.ind[i]) -= flux/listCell[n]->vol().abs(); 
    if (p >= 0) axb.A(p, sch.ind[i]) += flux/listCell[p]->vol().abs(); 
  }
  if (n >= 0) axb.b[n] += c*sch.c*area/listCell[n]->vol().abs(); 
  if (p >= 0) axb.b[p] -= c*sch.c*area/listCell[p]->vol().abs(); 
  return;  
  // int n = f->next; 
  // int p = f->prev;
  // auto c0 = (p>=0) ? *(listCell.begin() + p) : f;
  // auto c1 = (n>=0) ? *(listCell.begin() + n) : f;
  // Vec3 dx = c1->getCoord() - c0->getCoord(); 
  // Vec3 faceArea = f->vol(); 
  // Vec3 norm = faceArea/faceArea.abs();
  // if (p>=0 && n>=0) {
  //   double flux = c*faceArea.abs()/(dx*norm);
  //   axb.A[p][p] -= flux; 
  //   axb.A[n][n] -= flux; 
  //   axb.A[p][n] += flux; 
  //   axb.A[n][p] += flux;
  //   return; 
  // } else {
  //   if (!thisVar) {cout<<"laplace0: Boundary is not locked!"<<endl; return;}
  //   auto bndr = (p >= 0) ? -n-1 : -p-1; 
  //   auto row = (p >= 0) ? p : n; 
  //   if (bndr < 0 || bndr >= thisVar->listBC.size() || !(thisVar->listBC[bndr])) {
  //     cout << "wrong with bndr : Value "<< bndr <<endl; 
  //     return; 
  //   }
  //   auto bc = thisVar->listBC[bndr];
  //   if (bc->type == 0) {
  //     double flux = c*faceArea.abs()/(dx*norm);
  //     axb.A[row][row] -= flux*(1.0 - bc->a_val);
  //     axb.b[row] -= flux*(bc->b_val); 
  //   } else if (bc->type == 1) { 
  //     double flux = c*faceArea.abs();
  //     if (n >= 0) flux = -flux; 
  //     axb.A[row][row] += flux*(bc->a_val);
  //     axb.b[row] -= flux*(bc->b_val);
  //   } else {
  //     cout << "Type is not recognized!"<< endl; 
  //   }
  // }	
  return; 
}
Exemplo n.º 8
0
void Interpretter::evalSchemes(vector <Predicate>& schemeList) {
    output += "Scheme Evaluation\n\n";
    for (Predicate scheme : schemeList) {      //a list of predicates
        set <Tuple> tuples;
        Scheme s;
        for (auto param : scheme.getParams()) {
            s.push_back(param.toString());      //for whatever reason, we can't have objects used from previous labs, so dump to string here
        }
        Relation r(scheme.getID(), s, tuples); //scheme.getParams() needs to be a set
        db[r.getName()] = r;
        //add relation to database
    }
}
Exemplo n.º 9
0
void RDBMSInterpreter::retrieveRelations()
{
  for (vector<Scheme*>::iterator it = m_schemes.begin(); it != m_schemes.end(); it++)
    {
      Scheme* scheme = *it;
      
      Relation relation(scheme->id(), scheme->idList());
      
      readFacts(relation);
      
      m_relations[relation.name()] = relation;
    }
  
}
//static
uint SchemeUtils::calculateQuantumCost(const Scheme& scheme)
{
    uint size = scheme.size();

    if (size == 0)
        return 0;

    ReverseElement prevElement;
    bool isPreviousElementWasUsedBefore = true;

    uint cost = 0;
    for (auto& element : scheme)
    {
        if (!isPreviousElementWasUsedBefore)
        {
            uint peresCost = 0;
            if (isPeresGate(prevElement, element, &peresCost))
            {
                cost -= getElementQuantumCost(prevElement);
                cost += peresCost;

                isPreviousElementWasUsedBefore = true;
                continue;
            }
        }

        cost += getElementQuantumCost(element);

        prevElement = element;
        isPreviousElementWasUsedBefore = false;
    }

    return cost;
}
Exemplo n.º 11
0
//----------------------------------------------------------------------------//
void SchemeManager::doPostObjectAdditionAction(Scheme& scheme)
{
    if (d_autoLoadResources)
    {
        scheme.loadResources();
    }
}
Scheme GtGenerator::generate(const TruthTable& table)
{
    n = 0;

    float time = 0;
    {
        AutoTimer timer(&time);

        checkPermutationValidity(table);
        tie(n, permutation) = getPermutation(table);
    }

    debugLog("GtGenerator::generate()-dump-permutation-creation-time", [=](ostream& out)->void
    {
        out << "Permutation creation time: ";
        out << setiosflags(ios::fixed) << setprecision(2) << time / 1000;
        out << " sec" << endl;
    });

    debugLog("GtGenerator::generate()-dump-permutation", [&](ostream& out)->void
    {
        out << "Permutation (non-fixed points number is " << permutation.getElementCount() << ")\n";
        out << permutation << endl;
    });

    Scheme scheme;
    if (permutation.length())
    {
        Scheme::iterator targetIter = scheme.end();

        shared_ptr<PartialGtGenerator> partialGenerator(new PartialGtGenerator());
        partialGenerator->setPermutation(permutation, n);
        partialGenerator->prepareForGeneration();

        while (partialGenerator)
            partialGenerator = reducePermutation(partialGenerator, n, &scheme, &targetIter);
    }

    return scheme;
}
Exemplo n.º 13
0
Scheme<double> Cell::phi(vector<shared_ptr<Boundary> > const &bc, int_2 bias) {
  Scheme<double> sch; 
  if (next < 0 && prev < 0) {
    sch.push_pair(id, 1.0); 
  } else {
    // use next and prev to compute phi;
    if (next >= 0 && prev >= 0) {
      if (bias == 0) {
	double dn = abs((grid->listCell[next]->getCoord() - getCoord())*vol()); 
	double dp = abs((grid->listCell[prev]->getCoord() - getCoord())*vol()); 
	sch.push_pair(prev, dn/(dn+dp)); 
	sch.push_pair(next, dp/(dn+dp)); 
      } else if (bias == -1) { 
	sch.push_pair(prev, 1.0); 
      } else if (bias == 1) { 
	sch.push_pair(next, 1.0); 
      }
    } else {
      auto bndr = (prev >= 0) ? -next-1 : -prev-1; 
      auto row = (prev >= 0) ? prev : next; 
      if (bc[bndr]->type == 0) { 
	sch.push_constant(bc[bndr]->b_val);
	sch.push_pair(row, bc[bndr]->a_val); 
      } else if (bc[bndr]->type == 1) {
	auto c0 = grid->listCell[row]; 
	auto norm = vol(); norm = norm/norm.abs(); 
	double dx = norm*(getCoord() - c0->getCoord()); 
	sch.push_constant(dx*bc[bndr]->b_val);
	sch.push_pair(row, (1.0 + dx*bc[bndr]->a_val)); 
      } else { 
	cout << "Cell (Quad) :: interp :: boundary condition type not recognized " << endl; 
	exit(1); 
      }
 
    }
  }
  return sch; 
}
Exemplo n.º 14
0
Scheme Relation::join_scheme(Relation r2) {
	Scheme s = Scheme();

	// Put in the whole first scheme
	for (auto var : this->scheme)
		s.push_back(var);

	// Put in any additional vars from the second scheme
	for (auto var1 : this->scheme) {
		for (auto var2 : r2.scheme) {
			if (std::find(s.begin(), s.end(), var2) == s.end()) {
				s.push_back(var2);
			}
		}
	}

	return s;
}
Exemplo n.º 15
0
bool Scheme::operator > (const Scheme& compare) const
{
	return _tcsicmp(GetTitle(), compare.GetTitle()) > 0;
}
Scheme CompositeGenerator::generate(const TruthTable& table, ostream& outputLog)
{
    float totalTime = 0;
    float time = 0;

    // process truth table with Reed-Muller generator
    uint size = table.size();
    uint n = (uint)(log(size) / log(2));
    outputLog << "n = " << n << endl;

    uint threshold = getRmGeneratorWeightThreshold(n);
    outputLog << "RM generator index weight threshold: " << threshold << endl;

    RmGenerator rmGenerator(threshold);
    RmGenerator::SynthesisResult rmResult;

    {
        AutoTimer timer(&time);
        rmGenerator.generate(table, &rmResult);
    }
    totalTime += time;

    outputLog << "RM generator time: ";
    logTime(outputLog, time);
    outputLog << "RM scheme complexity: " << rmResult.scheme.size() << endl;

    // process residual truth table with Group Theory based generator
    GtGenerator gtGenerator;

    Scheme gtLeftScheme;
    Scheme gtRightScheme;

    {
        AutoTimer timer(&time);
        gtLeftScheme = gtGenerator.generate(rmResult.leftMultTable);
        gtRightScheme = gtGenerator.generate(rmResult.rightMultTable);
    }
    totalTime += time;

    outputLog << "GT generator time: ";
    logTime(outputLog, time);
    outputLog << "GT left scheme complexity: " << gtLeftScheme.size() << endl;
    outputLog << "GT right scheme complexity: " << gtRightScheme.size() << endl;

    // combine GT and RM schemes
    Scheme& scheme = rmResult.scheme;

    RmGenerator::PushPolicy pushPolicy = rmGenerator.getPushPolicy();
    if (pushPolicy.defaultPolicy)
    {
        if (gtLeftScheme.size() < gtRightScheme.size())
            scheme.insert(scheme.begin(), gtLeftScheme.cbegin(), gtLeftScheme.cend());
        else
            scheme.insert(scheme.end(), gtRightScheme.cbegin(), gtRightScheme.cend());
    }
    else
    {
        scheme.insert(scheme.begin(), gtLeftScheme.cbegin(), gtLeftScheme.cend());
        scheme.insert(scheme.end(), gtRightScheme.cbegin(), gtRightScheme.cend());
    }

    outputLog << "Complexity before optimization: " << scheme.size() << endl;
    outputLog << "Quantum cost before optimization: ";
    outputLog << SchemeUtils::calculateQuantumCost(scheme) << endl;

    // optimize scheme complexity
    PostProcessor postProcessor;

    {
        AutoTimer timer(&time);
        scheme = postProcessor.optimize(scheme);
    }
    totalTime += time;

    bool isValid = TruthTableUtils::checkSchemeAgainstPermutationVector(scheme, table);
    assert(isValid, string("Generated scheme is not valid"));

    // log post processing parameters
    outputLog << "Optimization time: ";
    logTime(outputLog, time);
    outputLog << "Complexity after optimization: " << scheme.size() << endl;
    outputLog << "Quantum cost after optimization: ";
    outputLog << SchemeUtils::calculateQuantumCost(scheme) << endl;

    outputLog << "Total time: ";
    logTime(outputLog, totalTime);

    return scheme;
}
Exemplo n.º 17
0
void peanoclaw::native::fullswof2DMain(
  peanoclaw::native::scenarios::SWEScenario& scenario,
  tarch::la::Vector<DIMENSIONS,int> numberOfCells
) {
  tarch::logging::Log _log("peanoclaw::native::fullswof2DMain(...)");

  int ghostlayerWidth = 1;

  FullSWOF2D_Parameters parameters(
    ghostlayerWidth,
    numberOfCells[0],
    numberOfCells[1],
    scenario.getInitialMinimalMeshWidth()[0],
    scenario.getInitialMinimalMeshWidth()[1],
    scenario.getDomainSize(),
    scenario.getEndTime(),
    #ifdef PEANOCLAW_FULLSWOF2D
    scenario.enableRain(),
    scenario.getFrictionCoefficient(),
    #else
    true,
    0.0,
    #endif
    scenario.getBoundaryCondition(0, false),
    scenario.getBoundaryCondition(0, true),
    scenario.getBoundaryCondition(1, false),
    scenario.getBoundaryCondition(1, true)
  );

  Choice_scheme * schemeWrapper;
  schemeWrapper = new Choice_scheme(parameters);
  Scheme* scheme = schemeWrapper->getInternalScheme();

  tarch::la::Vector<DIMENSIONS,int> subcellIndex;

  /** Water height.*/
  TAB& h = scheme->getH();
  for (int x = -ghostlayerWidth; x < numberOfCells(0)+ghostlayerWidth; x++) {
    for (int y = -ghostlayerWidth; y < numberOfCells(1)+ghostlayerWidth; y++) {
      assignList(subcellIndex) = x, y;
      tarch::la::Vector<DIMENSIONS,double> position
        = subcellIndex.convertScalar<double>() * tarch::la::invertEntries(numberOfCells.convertScalar<double>()) * scenario.getDomainSize();
      position += scenario.getDomainOffset();
      h[x+ghostlayerWidth][y+ghostlayerWidth] = scenario.getWaterHeight(
        (float)x / numberOfCells[0] * scenario.getDomainSize()[0] + scenario.getDomainOffset()[0],
        (float)y / numberOfCells[1] * scenario.getDomainSize()[1] + scenario.getDomainOffset()[1]
      );
    }
  }

  /** X Velocity.*/
  TAB& u = scheme->getU();
  for (int x = -ghostlayerWidth; x < numberOfCells(0)+ghostlayerWidth; x++) {
    for (int y = -ghostlayerWidth; y < numberOfCells(1)+ghostlayerWidth; y++) {
        assignList(subcellIndex) = x, y;
        u[x+ghostlayerWidth][y+ghostlayerWidth] = scenario.getVeloc_u(
          (float)x / numberOfCells[0] * scenario.getDomainSize()[0] + scenario.getDomainOffset()[0],
          (float)y / numberOfCells[1] * scenario.getDomainSize()[1] + scenario.getDomainOffset()[1]
        );
    }
  }

  /** Y Velocity.*/
  TAB& v = scheme->getV();
  for (int x = -ghostlayerWidth; x < numberOfCells(0)+ghostlayerWidth; x++) {
    for (int y = -ghostlayerWidth; y < numberOfCells(1)+ghostlayerWidth; y++) {
      assignList(subcellIndex) = x, y;
      v[x+ghostlayerWidth][y+ghostlayerWidth] = scenario.getVeloc_v(
        (float)x / numberOfCells[0] * scenario.getDomainSize()[0] + scenario.getDomainOffset()[0],
        (float)y / numberOfCells[1] * scenario.getDomainSize()[1] + scenario.getDomainOffset()[1]
      );
    }
  }

  /** Topography.*/
  TAB& z = scheme->getZ();
  for (int x = -ghostlayerWidth; x < numberOfCells(0)+ghostlayerWidth; x++) {
    for (int y = -ghostlayerWidth; y < numberOfCells(1)+ghostlayerWidth; y++) {
      assignList(subcellIndex) = x, y;
      z[x+ghostlayerWidth][y+ghostlayerWidth] = scenario.getBathymetry(
        (float)x / numberOfCells[0] * scenario.getDomainSize()[0] + scenario.getDomainOffset()[0],
        (float)y / numberOfCells[1] * scenario.getDomainSize()[1] + scenario.getDomainOffset()[1]
      );
    }
  }

  tarch::timing::Watch runtimeWatch("peanoclaw::native", "fullswof2DMain", true);

  double t = 0.0;
  while(tarch::la::smaller(t, scenario.getEndTime())) {

    //TODO unterweg debug
    std::cout << "t=" << t << std::endl;

    scheme->resetN();
    schemeWrapper->calcul();
    t += scheme->getTimestep();
  }

  runtimeWatch.stopTimer();

  //Print maximum memory demand
  logInfo("fullswof2DMain", "Peak resident set size: " << peanoclaw::statistics::getPeakRSS() << "b");
  delete scheme;
}
Exemplo n.º 18
0
Scheme<double> Cell::normGrad(vector<shared_ptr<Boundary> > const &bc) {
  Scheme<double> sch; 
  if (next < 0 && prev < 0) {
    // control volume of the cell;
    cout << "You can only call form normGrad for a face!!! " << endl; 
    exit(1); 
  } else {
    // use next and prev to compute phi;
    if (next >= 0 && prev >= 0) {
      if (grid->listCell[next]->level[orient] == grid->listCell[prev]->level[orient]) {
      	auto norm = vol(); 
      	auto area = norm.abs(); 
       	norm = norm/area;
       	auto dx = grid->listCell[next]->getCoord() - grid->listCell[prev]->getCoord(); 
	auto onebydx = 1.0/(dx*norm); 
       	sch.push_pair(next, onebydx);
       	sch.push_pair(prev, -onebydx); 
      }	else { // this part is cell specific // 2d-3d
	vector<Vec3> v; 
	vector<Scheme<double>> tmp; 
      	auto norm = vol(); 
       	norm = norm/norm.abs();
	v.push_back(grid->listCell[prev]->getCoord()); 
	v.push_back(*(grid->listVertex[node[0]])); 
	v.push_back(grid->listCell[next]->getCoord()); 
	v.push_back(*(grid->listVertex[node[1]])); 
	
	tmp.push_back(grid->listCell[prev]->phi(bc));
	tmp.push_back(grid->listVertex[node[0]]->phi(bc));
	tmp.push_back(grid->listCell[next]->phi(bc));
	tmp.push_back(grid->listVertex[node[1]]->phi(bc)); 
	
	tmp[3] += grid->listCell[prev]->phi(bc);
	tmp[0] += grid->listVertex[node[0]]->phi(bc);
	tmp[1] += grid->listCell[next]->phi(bc);
	tmp[2] += grid->listVertex[node[1]]->phi(bc); 
	
	auto vol = 0.5*((v[3]-v[1])^(v[2]-v[0])).abs(); 
	
	for (auto j = 0; j < 4; ++j) {
	  auto del = v[(j+1)%4] - v[j]; 
	  auto area = Vec3(-del[1], del[0], 0); 
	  for (auto i = 0; i < tmp[j].size(); ++i)
	    sch.push_pair(tmp[j].ind[i], (0.5*tmp[j].val[i]/vol)*area*norm); //0.5 from average;
	}	
       }      
    } else {
      //      cout << "**** " << vol() << " " << type << endl; 
      //      cout << *(grid->listVertex[node[0]]) << " " << *(grid->listVertex[node[1]]) << endl; 
      auto bndr = (prev >= 0) ? -next-1 : -prev-1; 
      auto row = (prev >= 0) ? prev : next; 
      auto norm = vol(); 
      auto area = norm.abs(); 
      norm = norm/area;
      auto dx = (next >= 0) ? grid->listCell[next]->getCoord() - getCoord() : getCoord() - grid->listCell[prev]->getCoord(); 
      auto onebydx = 1.0/(dx*norm);

      if (bc[bndr]->type == 0) {
	if (row == next) onebydx = -onebydx; 
      	sch.push_constant(bc[bndr]->b_val * onebydx);
      	sch.push_pair(row, (bc[bndr]->a_val - 1.0) * onebydx); 
      } else if (bc[bndr]->type == 1) {
      	sch.push_constant((bc[bndr]->b_val));
      	sch.push_pair(row, (bc[bndr]->a_val)); 	
      } else { 
      	cout << "Cell (Line) :: grad :: boundary condition type not recognized " << endl; 
      	exit(1); 
      }
    }
  }
  return sch; 
}
Exemplo n.º 19
0
void REScintilla::SetRE(LPCSTR regex, bool bClearStyling)
{
	// First of all build up the regular expression to use.
	CToolREBuilder builder;
	
	CA2CT regext(regex);
	tstring result = builder.Build(regext);
	CT2CA regexa(result.c_str());
	m_customre = regexa;
	
	/*if(m_pRE)
	{
		delete m_pRE;
		m_pRE = NULL;
	}*/

	if(!m_pRE)
	{
		m_pRE = new sregex;
	}

	try
	{
		// We pass 0 to disable the default UTF-8 matching, we're in ASCII in output window
		*m_pRE = sregex::compile(m_customre);

		g_Context.m_frame->SetStatusText(_T(""));
	}
	catch(boost::xpressive::regex_error& ex)
	{
		size_t len = strlen(ex.what()) + m_customre.size() + 90;
		TCHAR* buf = new TCHAR[len];
		buf[len - 1] = NULL;
		_sntprintf(buf, len - 1, _T("Custom Parser Error (%S): %S"), ex.what(), m_customre.c_str());
		g_Context.m_frame->SetStatusText(buf);
		delete [] buf;

		delete m_pRE;
		m_pRE = NULL;
	}

	if(!schemeLoaded)
	{
		// Now turn Scintilla into custom lex mode, first get styles from the output scheme.
		Scheme* pScheme = SchemeManager::GetInstance()->SchemeByName("output");
		if(pScheme && ::IsWindow(this->m_scihWnd))
		{
			pScheme->Load( *(static_cast<CScintilla*>(this)) );
			
			// Override some nastiness inherited from the default schemes...
			SPerform(SCI_SETCARETLINEVISIBLE, false);
			SPerform(SCI_SETEDGEMODE, EDGE_NONE);
		}

		// Switch to container-based lexing...
		SetLexer(SCLEX_CONTAINER);
	}

	if(bClearStyling)
	{
		// Clear all old styling...
		ClearDocumentStyle();
		
		// Now re-style the whole thing.
		//Colourise(0, -1); - doesn't work for SCLEX_CONTAINER
		ScintillaAccessor styler(this);
		styler.SetCodePage(GetCodePage());
		handleStyleNeeded(styler, 0, GetLength());
		styler.Flush();
	}
}