Skip to content
Snippets Groups Projects
Commit dd1ed40a authored by Matti Pellika's avatar Matti Pellika
Browse files

Next try

parent 53f37bce
No related branches found
No related tags found
No related merge requests found
......@@ -27,6 +27,12 @@ void updateFltkTree()
#endif
}
std::string convertInt(int number){
std::stringstream stream;
stream << number;
return stream.str();
}
std::map<GEntity*, std::set<MVertex*, MVertexLessThanNum>,
GEntityLessThan> ElemChain::_vertexCache;
......
......@@ -21,14 +21,7 @@
#if defined(HAVE_KBIPACK)
void updateFltkTree();
template <class TTypeA, class TTypeB>
bool convert(const TTypeA& input, TTypeB& output ){
std::stringstream stream;
stream << input;
stream >> output;
return stream.good();
}
std::string convertInt(int number);
// Class whose derivative classes are to have partial or total order
template <class Type>
......@@ -508,17 +501,16 @@ void Chain<C>::addToModel(GModel* m, bool post,
#if defined(HAVE_POST)
if(post && CTX::instance()->batch == 0) {
// create PView for instant visualization
/*std::string pnum = "";
convert(physicalNum, pnum);
std::string pnum = convertInt(physicalNum);
std::string postname = pnum + ": " + _name;
PView* view = new PView(postname, "ElementData", m, data, 0, 1);
// the user should be interested about the orientations
int size = 30;
/*int size = 30;
PViewOptions* opt = view->getOptions();
if(opt->tangents == 0) opt->tangents = size;
if(opt->normals == 0) opt->normals = size;
view->setOptions(opt);
updateFltkTree();*/
view->setOptions(opt);*/
updateFltkTree();
}
#endif
}
......
......@@ -208,12 +208,10 @@ void Homology::findHomologyBasis(std::vector<int> dim)
_deleteChains(dim);
for(int j = 0; j < 4; j++){
_betti[j] = 0;
std::string dimension = "";
convert(j, dimension);
std::string dimension = convertInt(j);
for(int i = 1; i <= chainComplex.getBasisSize(j, 3); i++){
std::string generator = "";
convert(i, generator);
std::string generator = convertInt(i);
std::string name = "H_" + dimension + domain + generator;
std::map<Cell*, int, Less_Cell> chain;
......@@ -291,13 +289,11 @@ void Homology::findCohomologyBasis(std::vector<int> dim)
_deleteCochains(dim);
for(int i = 0; i < 4; i++) _betti[i] = 0;
for(int j = 3; j > -1; j--){
std::string dimension = "";
convert(j, dimension);
std::string dimension = convertInt(j);
for(int i = 1; i <= chainComplex.getBasisSize(j, 3); i++){
std::string generator = "";
convert(i, generator);
std::string generator = convertInt(i);
std::string name = "H^" + dimension + domain + generator;
std::map<Cell*, int, Less_Cell> chain;
......@@ -538,8 +534,7 @@ std::string Homology::_getDomainString(const std::vector<int>& domain,
if(domain.empty()) domainString += "0";
else{
for(unsigned int i = 0; i < domain.size(); i++){
std::string temp = "";
convert(domain.at(i),temp);
std::string temp = convertInt(domain.at(i));
domainString += temp;
if (domain.size()-1 > i){
domainString += ", ";
......@@ -551,8 +546,7 @@ std::string Homology::_getDomainString(const std::vector<int>& domain,
if(!subdomain.empty()){
domainString += ", {";
for(unsigned int i = 0; i < subdomain.size(); i++){
std::string temp = "";
convert(subdomain.at(i),temp);
std::string temp = convertInt(subdomain.at(i));
domainString += temp;
if (subdomain.size()-1 > i){
domainString += ", ";
......
......@@ -288,11 +288,9 @@ PView *GMSH_HomologyPostProcessingPlugin::execute(PView *v)
ElemChain::clearVertexCache();
}
std::string dims = "";
std::string nums = "";
for(unsigned int i = 0; i < newBasis.size(); i++) {
convert(newBasis.at(i).getDim(), dims);
convert(i+1, nums);
std::string dims = convertInt(newBasis.at(i).getDim());
std::string nums = convertInt(i+1);
newBasis.at(i).setName("C" + dims + " " + cname + nums);
newBasis.at(i).addToModel(m);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment