.. _program_listing_file_src_performance_indicators.hpp: Program Listing for File performance_indicators.hpp =================================================== |exhale_lsh| :ref:`Return to documentation for file ` (``src/performance_indicators.hpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp /*** * $Id$ ** * File: performance_indicators.hpp * Created: May 9, 2012 * * Author: Olga Wodo, Baskar Ganapathysubramanian * Copyright (c) 2012 Olga Wodo, Baskar Ganapathysubramanian * See accompanying LICENSE. * * This file is part of GraSPI. */ #ifndef PERFORMANCE_INDICATORS_HPP #define PERFORMANCE_INDICATORS_HPP #include "graspi_types.hpp" #include "performance_indicators_abs.hpp" #include "performance_indicators_diss.hpp" #include "performance_indicators_charge_transport.hpp" #include "graspi_descriptors.hpp" #include namespace graspi { inline double perfomance_indicator( graph_t* G, const dim_g_t& d_g, const vertex_colors_t& C, const dim_a_t& d_a, const edge_weights_t& W, const edge_colors_t& L, const vertex_ccs_t& vCC, const ccs_t& CC, double pixelsize ) { //*****************************************************************// // Light absorption morphology descriptors: // //*****************************************************************// foo_w_abs wfoo_abs; double F_ABS = wf_abs(C,d_a,wfoo_abs,pixelsize); //*****************************************************************// // Exciton diffusion and dissociation morphology descriptors: // //*****************************************************************// double Ld = 10; std::pair F_DISS = wf_diss(G,d_g,C,W,vCC,CC,Ld,BLACK,GREEN); //*****************************************************************// // Charge transport morphology descriptors: // //*****************************************************************// unsigned int n = boost::num_vertices(*G); std::vector distances(n); compute_shortest_distance_from_sourceC_to_targetC(RED,BLACK, G, d_g, C, W, distances, std::string("")); double black_tort_1 = determine_tortuosity( C, d_a, pixelsize, distances, RED, BLACK); for(unsigned int i=0; i n_useful = find_useful_cc(descriptors, G, C, vCC, CC); // int n_black_useful = n_useful.first; // int n_white_useful = n_useful.second; double Ld = 10.0; std::pair F_DISS = wf_diss(G,d_g,C,W,vCC,CC,Ld,BLACK,GREEN); descriptors.update_desc("DISS_wf10_D",F_DISS.first); descriptors.update_desc("DISS_f10_D",F_DISS.second); std::pair int_path = identify_complementary_paths_from_green(G,C,L,vCC,CC); descriptors.update_desc("STAT_e",int_path.first); descriptors.update_desc("CT_e_conn",int_path.second); double desc_tmp=((double)int_path.second)/((double)int_path.first); descriptors.update_desc("CT_f_e_conn",desc_tmp); //*****************************************************************// // Charge transport morphology descriptors: // //*****************************************************************// unsigned int n = boost::num_vertices(*G); std::vector distances(n); std::set id_blacks_conn_green_red; std::set id_whites_conn_green_blue; //identify_black_vertices_connected_directly_to_interface identify_useful_triple_black_white_green( G, C, vCC, CC, id_blacks_conn_green_red, id_whites_conn_green_blue); descriptors.update_desc("CT_e_D_An",(float)id_blacks_conn_green_red.size()); descriptors.update_desc("CT_e_A_Ca",(float)id_whites_conn_green_blue.size()); // (1) determine the shorest distances from any black vertex to red and print to file // (2) print to file only these distances corresponding to vertices adjacent to interface // (3) compute tortuosity and print it compute_shortest_distance_from_sourceC_to_targetC(RED,BLACK, G, d_g, C, W, distances); int distZero=count_if(distances.begin(), distances.end(), IsZero); descriptors.update_desc("CT_n_D_adj_An",distZero); double black_tort_1 = determine_tortuosity( C, d_a, pixelsize,distances,RED,BLACK); descriptors.update_desc("CT_f_D_tort1",black_tort_1); // repeat three above steps for distanced from any white to red for(unsigned int i=0; i n_useful = find_useful_cc(descriptors, G, C, vCC, CC); // int n_black_useful = n_useful.first; // int n_white_useful = n_useful.second; double Ld = 10.0; filename = res_path + std::string("DistancesBlackToGreen.txt"); std::string wfilename = res_path + std::string("WDistancesBlackToGreen.txt"); std::pair F_DISS = wf_diss(G,d_g,C,W,vCC,CC,Ld,filename,wfilename,BLACK,GREEN); // os << "[F DISS] Weighted fraction of black vertices in " << Ld << " distance to interface: " << F_DISS.first << std::endl; // os << "[F DISS] Fraction of black vertices in " << Ld << " distance to interface: " << F_DISS.second << std::endl; descriptors.update_desc("DISS_wf10_D",F_DISS.first); descriptors.update_desc("DISS_f10_D",F_DISS.second); std::pair int_path = identify_complementary_paths_from_green(G,C,L,vCC,CC); // os << "[F DISS] Number of interface edges: " << int_path.first << std::endl; // os << "[STATS] Number of interface edges with complementary paths: " << int_path.second << std::endl; // os << "[F CT] Fraction of interface with " << "complementary paths to bottom and top: " << ((double)int_path.second)/((double)int_path.first) << std::endl; descriptors.update_desc("STAT_e",int_path.first); descriptors.update_desc("CT_e_conn",int_path.second); double desc_tmp=((double)int_path.second)/((double)int_path.first); descriptors.update_desc("CT_f_e_conn",desc_tmp); //*****************************************************************// // Charge transport morphology descriptors: // //*****************************************************************// unsigned int n = boost::num_vertices(*G); std::vector distances(n); std::set id_blacks_conn_green_red; std::set id_whites_conn_green_blue; //identify_black_vertices_connected_directly_to_interface identify_useful_triple_black_white_green( G, C, vCC, CC, id_blacks_conn_green_red, id_whites_conn_green_blue); // os << "[STATS] Number of black interface vertices with path to top: " << id_blacks_conn_green_red.size() << std::endl; // os << "[STATS] Number of white interface vertices with path to bottom: " << id_whites_conn_green_blue.size() << std::endl; descriptors.update_desc("CT_e_D_An",(float)id_blacks_conn_green_red.size()); descriptors.update_desc("CT_e_A_Ca",(float)id_whites_conn_green_blue.size()); // (1) determine the shorest distances from any black vertex to red and print to file // (2) print to file only these distances corresponding to vertices adjacent to interface // (3) compute tortuosity and print it filename = res_path + std::string("DistancesBlackToRed.txt"); compute_shortest_distance_from_sourceC_to_targetC(RED,BLACK, G, d_g, C, W, distances, filename); int distZero=count_if(distances.begin(), distances.end(), IsZero); descriptors.update_desc("CT_n_D_adj_An",distZero); filename = res_path + std::string("DistancesGreenToRedViaBlack.txt"); print_distances_of_ids(distances,id_blacks_conn_green_red, filename); filename = res_path + std::string("TortuosityBlackToRed.txt"); std::string id_t_filename = res_path + std::string("IdTortuosityBlackToRed.txt"); double black_tort_1 = determine_and_print_tortuosity( C, d_a, pixelsize,distances, filename, id_t_filename,RED,BLACK); // os << "[F CT] Fraction of black vertices with straight rising paths" // << " (t=1): " << black_tort_1 << std::endl; descriptors.update_desc("CT_f_D_tort1",black_tort_1); // repeat three above steps for distanced from any white to red for(unsigned int i=0; i n_useful = find_useful_cc(descriptors, G, C, vCC, CC); // , os // int n_black_useful = n_useful.first; // int n_white_useful = n_useful.second; //*****************************************************************// // Exciton diffusion and dissociation morphology descriptors: // //*****************************************************************// double Ld = 10.0; filename = res_path + std::string("DistancesBlackToGreen.txt"); std::string wfilename = res_path + std::string("WDistancesBlackToGreen.txt"); std::pair F_DISS = wf_diss(G,d_g,C,W,vCC,CC,Ld,filename,wfilename,BLACK,GREEN); os << "[F DISS] Weighted fraction of black vertices in " << Ld << " distance to interface: " << F_DISS.first << std::endl; os << "[F DISS] Fraction of black vertices in " << Ld << " distance to interface: " << F_DISS.second << std::endl; filename = res_path + std::string("DistancesGreyToLGreen.txt"); wfilename = res_path + std::string("WDistancesGreyToLGreen.txt"); F_DISS = wf_diss(G,d_g,C,W,vCC,CC,Ld,filename,wfilename,GREY,LGREEN); os << "[F DISS] Weighted fraction of grey vertices in " << Ld << " distance to grey-white interface: " << F_DISS.first << std::endl; os << "[F DISS] Fraction of grey vertices in " << Ld << " distance to grey-white interface: " << F_DISS.second << std::endl; //*****************************************************************// // Morphology descriptors related to the interface // //*****************************************************************// std::pair int_path = identify_complementary_paths_from_green(G,C,L,vCC,CC); os << "[F DISS] Number of interface edges: " << int_path.first << std::endl; os << "[STATS] Number of interface edges with complementary paths: " << int_path.second << std::endl; os << "[F CT] Fraction of interface with " << "complementary paths to bottom and top: " << ((double)int_path.second)/((double)int_path.first) << std::endl; //*****************************************************************// // Charge transport morphology descriptors: // //*****************************************************************// unsigned int n = boost::num_vertices(*G); std::vector distances(n); std::set id_blacks_conn_green_red; std::set id_whites_conn_green_blue; //identify_black_vertices_connected_directly_to_interface identify_useful_triple_black_white_green( G, C, vCC, CC, id_blacks_conn_green_red, id_whites_conn_green_blue); os << "[STATS] Number of black interface vertices with path to top: " << id_blacks_conn_green_red.size() << std::endl; os << "[STATS] Number of white interface vertices with path to bottom: " << id_whites_conn_green_blue.size() << std::endl; // (1) determine the shorest distances from any black vertex to red and print to file // (2) print to file only these distances corresponding to vertices adjacent to interface // (3) compute tortuosity and print it filename = res_path + std::string("DistancesBlackToRed.txt"); compute_shortest_distance_from_sourceC_to_targetC(RED,BLACK, G, d_g, C, W, distances, filename); filename = res_path + std::string("DistancesGreenToRedViaBlack.txt"); print_distances_of_ids(distances,id_blacks_conn_green_red, filename); filename = res_path + std::string("TortuosityBlackToRed.txt"); std::string id_t_filename = res_path + std::string("IdTortuosityBlackToRed.txt"); double black_tort_1 = determine_and_print_tortuosity( C, d_a, pixelsize,distances, filename, id_t_filename,RED,BLACK); os << "[F CT] Fraction of black vertices with straight rising paths" << " (t=1): " << black_tort_1 << std::endl; // repeat three above steps for distanced from any white to red for(unsigned int i=0; i