[RNABuilder-help] Re: distro
Samuel Flores
samuelfloresc at gmail.com
Thu Mar 19 01:24:32 PDT 2015
On Mar 19, 2015, at 12:36 AM, Alex Tek <alex.tek.fr at gmail.com> wrote:
>> As I understand your code, you first create a wrapper struct whose members look like the ParameterReader members. Then you have functions to copy from the ParameterReader to the wrapper and back, all in c++. Then in params.py you have a python version of the wrapper, which I think is perhaps hard coded to directly access the wrapper.
>>
>> The wrappers add a bit of risk of bugs since changes have to be made in multiple places. Is there any way this could be avoided? Is it possible to use SWIG?
> Yes SWIG is probably a good solution.
It seems to me that you are doing more than just translating c++ headers to c. the updateParameterReader_wrapper method has no equilivalent in ParameterReader.cpp, for instance. So SWIG might involve doing things very differently, compared to what we are doing currently.
> In the meantime, update share and check genCtypesStructs.py. I fixed it to make it generate proper wrappers, but only for ParameterReader.
So you made an automated wrapper generator! very impressive.
It’s spitting out a bunch of errors though, appended below. Or are these just warnings? It seemed to compile fine anyway. either way I think we’re done with the mmb.pdb issue. Thanks for your help.
> Usage: python share/genCtypesStructs.py include/ParameterReader.h include/ParameterReader_wrapper.h share/pyMMB/params.py
> (you have to be at the root of the project).
> In the past, I used this script for the classes and structs in utils.h. But it doesn't produce ready to use wrappers. This is probably broken now anyway.
>>
>> Alternatively, would it not be better, if the params.py were linked hard to ParameterReader rather than its wrapper? I don’t see that there is any validation happening, which would be one reason to have ParameterReader_wrapper.h. Is this possible? Bear in mind I’m a python amateur.
> No, unfortunately you can't do that. Python can execute C functions, but not C++. Indeed, once compiled, C++ method names are modified (see C++ name mangling for more info), making it unreliable to be wrapped.
> This is why we have these wrappers. Notice that the code of python_wrapper.cpp is wrapped inside an extern "C" declaration, marking it as C code for programs using the library. Note that only the signature of the functions has to follow the C rules. Their guts can totally use c++, and this is what we do here.
>
> And actually, python_wrapper.cpp is quite ill named as it is really a C wrapper. The python wrappers are in wrappers.py.
> SWIG is doing the same thing, except that it's automatized.
>>
>>
samuel-floress-macbook-pro-3:trunk Sam$ python share/genCtypesStructs.py include/ParameterReader.h include/ParameterReader_wrapper.h share/pyMMB/params.py
Unknown type: // ParameterReader & operator = (const ParameterReader in ParameterReader
Unknown type: ErrorManager & in ParameterReader
Unknown type: // in ParameterReader
Unknown type: vector<CovalentBondClass> in ParameterReader
Unknown type: vector<IncludeIntraChainInterface> in ParameterReader
Unknown type: BasePairContainer in ParameterReader
Unknown type: map<const ChainResidueIndex, BasePairPartner,twoIndexCmp> in ParameterReader
Unknown type: // variables previously declared and initialized in in ParameterReader
Unknown type: //bool in ParameterReader
Unknown type: //bool in ParameterReader
Unknown type: //String in ParameterReader
Unknown type: //bool in ParameterReader
Unknown type: //int in ParameterReader
Unknown type: //int in ParameterReader
Unknown type: BondMobility::Mobility in ParameterReader
Unknown type: BondMobility::Mobility in ParameterReader
Unknown type: BondMobility::Mobility in ParameterReader
Unknown type: BondMobility::Mobility in ParameterReader
Unknown type: Vector in ParameterReader
Unknown type: LeontisWesthofClass in ParameterReader
Unknown type: // end of variables improted from in ParameterReader
Unknown type: //int in ParameterReader
Unknown type: //int in ParameterReader
Unknown type: //vector<Biopolymer> in ParameterReader
Unknown type: //vector<String> in ParameterReader
Unknown type: vector<int> in ParameterReader
Unknown type: map<const ChainResidueIndex, int,twoIndexCmp> in ParameterReader
Unknown type: //vector<double> in ParameterReader
Unknown type: //vector<int> in ParameterReader
Unknown type: //vector<double> in ParameterReader
Unknown type: //vector<int> in ParameterReader
Unknown type: /*vector<double> in ParameterReader
Unknown type: vector<int> in ParameterReader
Unknown type: vector<double> in ParameterReader
Unknown type: vector<int> in ParameterReader
Unknown type: LeontisWesthofClass in ParameterReader
Unknown type: mutable map<const String,double> in ParameterReader
Unknown type: DensityMap in ParameterReader
Unknown type: DensityMap in ParameterReader
Unknown type: MobilizerContainer in ParameterReader
Unknown type: PhysicsContainer in ParameterReader
Unknown type: ConstraintToGroundContainer in ParameterReader
Unknown type: DisplacementContainer in ParameterReader
Unknown type: AtomSpringContainer in ParameterReader
Unknown type: BiopolymerClassContainer in ParameterReader
Unknown type: MoleculeClassContainer in ParameterReader
Unknown type: WaterDropletContainer in ParameterReader
Unknown type: map<const String,String> in ParameterReader
Unknown type: map<const String,String> in ParameterReader
Unknown type: map<const String, int> in ParameterReader
Unknown type: map<const String,int>::iterator in ParameterReader
Unknown type: // //void addRingClosingBond(const String chainID, ResidueID residueID1, String atomName1,String bondCenterName1, ResidueID residueID2, String atomName2,String in ParameterReader
Unknown type: // void addC1pSprings (LeontisWesthofClass in ParameterReader
Unknown type: // void applyAtomSprings (SimbodyMatterSubsystem & matter, GeneralForceSubsystem & in ParameterReader
Unknown type: // void configureDumm( DuMMForceFieldSubsystem & in ParameterReader
Unknown type: // static double myAtoF(map<const String,double> myUserVariables,const char* value in ParameterReader
Unknown type: // static bool aToBool( const String& name, const char* value in ParameterReader
Unknown type: // static bool compareUpper( const String& param, const char* symbol in ParameterReader
Unknown type: vector<BasePair> in ParameterReader
Unknown type: ContactContainer in ParameterReader
Unknown type: DensityContainer in ParameterReader
Unknown type: DensityContainer in ParameterReader
Unknown type: vector<SingleBondMobility> in ParameterReader
Unknown type: vector<BasePairPartner> in ParameterReader
Unknown type: //vector<IncludeAllNonBondAtomsInResidue> in ParameterReader
Unknown type: vector<AllResiduesWithin> in ParameterReader
Unknown type: vector<IncludeNonBondAtomInBiopolymerStruct> in ParameterReader
Unknown type: vector <WaterDropletAboutResidueStruct> in ParameterReader
Unknown type: vector<MobilizerDomainsInterface> in ParameterReader
Unknown type: // void removeBasePairsInRigidStretch in ParameterReader
Unknown type: // void printAllSettings ( ostream & myOstream = std::cout, String remarkString = in ParameterReader
Unknown type: // void removeNonPriorityBasePairs (int in ParameterReader
Unknown type: // //int getFirstResidueNumbers(const String myChainId) in ParameterReader
Unknown type: // // int getProteinFirstResidueNumbers(const String myProteinChainId) in ParameterReader
Unknown type: // //int getBasePriority(int baseResidueNumber,String baseChain, String basePairingEdge) in ParameterReader
Unknown type: // // int getNumBasePairs() in ParameterReader
Unknown type: // void addAllResiduesWithin(String chainID, int resID, double in ParameterReader
Unknown type: // void updateAllResiduesWithin(int index, String chainID, int resID, double in ParameterReader
Unknown type: // void deleteAllResiduesWithin(int in ParameterReader
Unknown type: // void updateIncludeAllNonBondAtomsInResidue(int index, String chainID, int in ParameterReader
Unknown type: // void deleteIncludeAllNonBondAtomsInResidue(int in ParameterReader
Unknown type: // //int in ParameterReader
Unknown type: // //int calcLowestBondingResidue(const String in ParameterReader
Unknown type: // //int calcHighestBondingResidue(const String in ParameterReader
Unknown type: // void in ParameterReader
Unknown type: // void parameterStringInterpreter(const String & in ParameterReader
Unknown type: // void initializeFromFileOnly(const char * parameterFileName = "./commands.dat" in ParameterReader
Unknown type: // void setFirstAndLastStage(const char * parameterFileName = "./commands.dat" in ParameterReader
Unknown type: // void loadSequencesFromPdb(const char * in ParameterReader
Unknown type: // //void in ParameterReader
Unknown type: // // void in ParameterReader
Unknown type: // // void in ParameterReader
Unknown type: // void in ParameterReader
Unknown type: // void in ParameterReader
Unknown type: // void in ParameterReader
Unknown type: // void in ParameterReader
Unknown type: // void in ParameterReader
Unknown type: // // void initializeDefaults in ParameterReader
Unknown type: // void initializeDefaults(const char * leontisWesthofInFileName = in ParameterReader
Unknown type: // void initialize(const char * parameterFileName = "./commands.dat" in ParameterReader
Unknown type: // //bool chainIsBiopolymer(String myChainId in ParameterReader
Unknown type: // //bool chainIsMonoAtoms(String in ParameterReader
Unknown type: // //int getChainIndex(String myChainId , vector<Biopolymer> & in ParameterReader
Unknown type: MonoAtomsContainer in ParameterReader
Unknown type: //dutyCycle = in ParameterReader
Unknown type: //priority = in ParameterReader
samuel-floress-macbook-pro-3:trunk Sam$
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://simtk.org/pipermail/rnatoolbox-help/attachments/20150319/e2bce415/attachment-0001.html
More information about the Rnatoolbox-help
mailing list